#ifndef Prozess_H
#define Prozess_H

#include "OperatingSystem.h"
#include "ReferenceCounter.h"

#ifdef WIN32
#    pragma comment(lib, "Psapi.lib")
#endif

namespace Framework
{
#ifdef WIN32
    struct MemoryInfo; //! from this file
#endif
    class Process; //! from this file

#ifdef WIN32
    struct MemoryInfo
    {
        unsigned long ausgelagerteFehler;
        __int64 hoechsteAusgelagerterSpeicher;
        __int64 ausgelagerterSpeicher;
        __int64 hoechsterAusgelagerterPool;
        __int64 ausgelagerterPool;
        __int64 hoechsterNichtAusgelagerterPool;
        __int64 nichtAusgelagerterPool;
        __int64 vorreservierterSpeicher;
        __int64 hoechsterVorreservierterSpeicher;
    };
#endif
    //! This class retrieves information about a running process
    //! (CPU, MEM). On Ubuntu always the own process
    class Process : public virtual ReferenceCounter
    {
    private:
#ifdef WIN32
        int numProcessors;
        ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
        void* pHandle;
#endif

    public:
        //! Constructor
        DLLEXPORT Process();
        //! non-constant
#ifdef WIN32
        //! Sets the process to monitor (Windows only)
        DLLEXPORT void setProcess(void* pHandle);
#endif
        //! Returns the CPU usage of the process
        DLLEXPORT double getCPU() const;
        //! Returns the memory usage of the process
        DLLEXPORT __int64 getMem() const;
#ifdef WIN32
        //! Returns detailed information about the memory usage of the
        //! process (Windows only)
        DLLEXPORT MemoryInfo getMemInfo() const;
        //! Returns the number of threads (Windows only)
        DLLEXPORT int getThreadCount() const;
#endif
    };
} // namespace Framework

#endif