gcontini
2020-02-24 d4edbb5a0aae0211389ce86264809b4237c73769
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * cpu_info.h
 *
 *  Created on: Dec 14, 2019
 *      Author: devel
 */
 
#ifndef SRC_LIBRARY_OS_CPU_INFO_H_
#define SRC_LIBRARY_OS_CPU_INFO_H_
#include <string>
namespace license {
namespace os {
typedef enum { BARE_TO_METAL, VMWARE, VIRTUALBOX, V_XEN, KVM, HV, V_OTHER } VIRTUALIZATION_DETAIL;
 
/**
 * Cpu informations
 */
class CpuInfo {
private:
    bool is_hypervisor_set() const;
 
public:
    CpuInfo();
    virtual ~CpuInfo();
    /**
     * Detect Virtual machine using hypervisor bit or the cpu vendor name.
     * @return true if the cpu is detected to be a virtual cpu
     */
    bool cpu_virtual() const;
    uint32_t model() const;
    std::string vendor() const;
    VIRTUALIZATION_DETAIL getVirtualizationDetail() const;
};
 
}  // namespace os
}  // namespace license
#endif /* SRC_LIBRARY_OS_CPU_INFO_H_ */