23 |
#include <fstream> |
#include <fstream> |
24 |
#include <sstream> |
#include <sstream> |
25 |
#include <stdexcept> |
#include <stdexcept> |
26 |
|
#include <stdlib.h> |
27 |
|
|
28 |
AcpiParser::AcpiParser() |
AcpiParser::AcpiParser() |
29 |
{ |
{ |
41 |
char buffer[1024]; |
char buffer[1024]; |
42 |
std::ifstream in; |
std::ifstream in; |
43 |
|
|
44 |
in.open("/proc/acpi/processor/CPU1/throttling"); |
in.open("/proc/acpi/processor/CPU0/throttling"); |
45 |
if (!in) |
if (!in) |
46 |
throw std::runtime_error("Could not open file"); |
throw std::runtime_error("Could not open file"); |
47 |
|
|
74 |
//std::cout << "tmp: >" << tmp << "< = " << std::endl; |
//std::cout << "tmp: >" << tmp << "< = " << std::endl; |
75 |
break; |
break; |
76 |
} |
} |
77 |
|
case 3: |
78 |
|
break; |
79 |
default: |
default: |
80 |
mStateDescriptions.push_back( value ); |
mStateDescriptions.push_back( value ); |
81 |
} |
} |
116 |
throw std::invalid_argument("newState too small"); |
throw std::invalid_argument("newState too small"); |
117 |
|
|
118 |
std::ofstream out; |
std::ofstream out; |
119 |
out.open("/proc/acpi/processor/CPU1/throttling"); |
out.open("/proc/acpi/processor/CPU0/throttling"); |
120 |
|
|
121 |
if (!out) |
if (!out) |
122 |
throw std::runtime_error("Could not open file"); |
throw std::runtime_error("Could not open file"); |