/** * @file include/ActivMiddleware/ActivBase/SystemInfo.h * * @brief Header file for the system info class. */ #if (!defined ACTIV_BASE_SYSTEM_INFO_H) #define ACTIV_BASE_SYSTEM_INFO_H #include "ActivMiddleware/ActivBase/External.h" #include "ActivMiddleware/ActivBase/CpuDetail.h" #include //! Activ namespace. namespace Activ { class MessageBuilder; class MessageValidator; // --------------------------------------------------------------------------------------------------------------------------------- /** * @brief System information. */ class SystemInfo { public: /** * @brief Default constructor. * * Sets no members. */ ACTIV_BASE_API SystemInfo(); /** * @brief Populate all members. * * @throw Exception. */ ACTIV_BASE_API void Populate(); /** * @brief Serialize this SystemInfo in non-versioned generic self-describing format. * * @param messageBuilder to serialize into. * * @return STATUS_CODE_SUCCESS or error code. */ ACTIV_BASE_API StatusCode Serialize2(MessageBuilder &messageBuilder) const; /** * @brief Serialize this SystemInfo in legacy versioned format. * * @param messageBuilder to serialize into. * * @return STATUS_CODE_SUCCESS or error code. */ ACTIV_BASE_API StatusCode SerializeVersioned(MessageBuilder &messageBuilder) const; /** * @brief Serialize this SystemInfo in legacy versioned format, to the version of the SystemInfo parameter. * * @param messageBuilder to serialize into. * @param systemInfo containing the version to serialize to. * * @return STATUS_CODE_SUCCESS or error code. */ ACTIV_BASE_API StatusCode SerializeVersioned(MessageBuilder &messageBuilder, const SystemInfo &systemInfo) const; /** * @brief Deserialize SystemInfo in generic self-describing format. * * @param messageValidator to deserialize from. * * @return STATUS_CODE_SUCCESS or error code. */ ACTIV_BASE_API StatusCode Deserialize2(MessageValidator &messageValidator); /** * @brief Deserialize SystemInfo in legacy versioned format. * * @param messageValidator to deserialize from. * * @return STATUS_CODE_SUCCESS or error code. */ ACTIV_BASE_API StatusCode DeserializeVersioned(MessageValidator &messageValidator); //! Get the machine's hostname; empty string if unable to retrieve. ACTIV_BASE_API static const String GetHostName(); typedef std::vector ProcessorInfoList; // Machine info. size_t m_numberOfProcessorThreads; ///< Number of logical processors in the machine (e.g. HT enabled). size_t m_numberOfProcessorCores; ///< Number of processor cores across all packages in the machine. size_t m_numberOfProcessorPackages; ///< Number of actual physical processors in the machine. ProcessorInfoList m_processorInfoList; ///< List of processor info. size_t m_l1CacheLineSize; ///< Size of l1 cache line in bytes. CpuDetailList m_cpuDetailList; ///< List of cpu details indexed by OS core Id. uint64_t m_physicalMemory; ///< Amount of physical RAM in the machine. uint64_t m_freeMemory; ///< Amount of free RAM in the machine. String m_osName; ///< Printable os name string. String m_schedulerInfo; ///< Printable info about scheduler. String m_computerName; ///< Name of the computer. uint64_t m_totalSwapBytes; ///< Total amount of swap. uint64_t m_freeSwapBytes; ///< Amount of free swap. // ActivMiddleware info. PlatformType m_platformType; ///< ActivMiddleware platform. uint32_t m_middlewareVersionValue; ///< Numeric ActivMiddleware version. String m_middlewareVersion; ///< ActivMiddleware version string. String m_middlewareDate; ///< Date/time of compilation of ActivMiddleware. String m_boostVersion; ///< Boost version info. private: /** * @brief Serialize this SystemInfo to a specific legacy version. * * @param messageBuilder to serialize into. * @param version containing the version to serialize to. * * @return STATUS_CODE_SUCCESS or error code. */ StatusCode SerializeVersioned(MessageBuilder &messageBuilder, const byte_t version) const; static const byte_t currentVersion = 2; ///< Current default serialized version. byte_t m_version; uint32_t m_context; class Message; }; } // namespace Activ #endif // (!defined ACTIV_BASE_SYSTEM_INFO_H)