Enterprise policy: Ignore the deprecated ForceSafeSearch if ForceGoogleSafeSearch...
[chromium-blink-merge.git] / third_party / power_gadget / PowerGadgetLib.h
blob59a23d836f384eb2943b5f747ad1b1a1690f6d2b
1 // Copyright (c) 2014, Intel Corporation
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Intel Corporation nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <Windows.h>
31 #include <string>
33 typedef bool (*IPGInitialize) ();
34 typedef bool (*IPGGetNumNodes) (int *nNodes);
35 typedef bool (*IPGGetNumMsrs) (int *nMsr);
36 typedef bool (*IPGGetMsrName) (int iMsr, wchar_t *szName);
37 typedef bool (*IPGGetMsrFunc) (int iMsr, int *funcID);
38 typedef bool (*IPGGetIAFrequency) (int iNode, int *freqInMHz);
39 typedef bool (*IPGGetTDP) (int iNode, double *TDP);
40 typedef bool (*IPGGetMaxTemperature) (int iNode, int *degreeC);
41 typedef bool (*IPGGetTemperature) (int iNode, int *degreeC);
42 typedef bool (*IPGReadSample) ();
43 typedef bool (*IPGGetSysTime) (SYSTEMTIME *pSysTime);
44 typedef bool (*IPGGetRDTSC) (UINT64 *TSC);
45 typedef bool (*IPGGetTimeInterval) (double *offset);
46 typedef bool (*IPGGetBaseFrequency) (int iNode, double *baseFrequency);
47 typedef bool (*IPGGetPowerData) (int iNode, int iMSR, double *result, int *nResult);
48 typedef bool (*IPGStartLog) (wchar_t *szFileName);
49 typedef bool (*IPGStopLog) ();
51 class CIntelPowerGadgetLib
53 public:
54 CIntelPowerGadgetLib(void);
55 ~CIntelPowerGadgetLib(void);
57 bool IntelEnergyLibInitialize(void);
58 bool GetNumNodes(int * nNodes);
59 bool GetNumMsrs(int *nMsrs);
60 bool GetMsrName(int iMsr, wchar_t *szName);
61 bool GetMsrFunc(int iMsr, int *funcID);
62 bool GetIAFrequency(int iNode, int *freqInMHz);
63 bool GetTDP(int iNode, double *TDP);
64 bool GetMaxTemperature(int iNode, int *degreeC);
65 bool GetTemperature(int iNode, int *degreeC);
66 bool ReadSample();
67 bool GetSysTime(SYSTEMTIME *sysTime);
68 bool GetRDTSC(UINT64 *TSC);
69 bool GetTimeInterval(double *offset);
70 bool GetBaseFrequency(int iNode, double *baseFrequency);
71 bool GetPowerData(int iNode, int iMSR, double *results, int *nResult);
72 bool StartLog(wchar_t *szFilename);
73 bool StopLog();
74 std::string GetLastError();
76 private:
77 IPGInitialize pInitialize;
78 IPGGetNumNodes pGetNumNodes;
79 IPGGetNumMsrs pGetNumMsrs;
80 IPGGetMsrName pGetMsrName;
81 IPGGetMsrFunc pGetMsrFunc;
82 IPGGetIAFrequency pGetIAFrequency;
83 IPGGetTDP pGetTDP;
84 IPGGetMaxTemperature pGetMaxTemperature;
85 IPGGetTemperature pGetTemperature;
86 IPGReadSample pReadSample;
87 IPGGetSysTime pGetSysTime;
88 IPGGetRDTSC pGetRDTSC;
89 IPGGetTimeInterval pGetTimeInterval;
90 IPGGetBaseFrequency pGetBaseFrequency;
91 IPGGetPowerData pGetPowerData;
92 IPGStartLog pStartLog;
93 IPGStopLog pStopLog;