27 #include <sys/utsname.h>
28 #include <sys/types.h>
69 struct utsname sysdata;
72 dir = opendir(dirname);
74 if (mkdir(dirname, 0755)) {
76 fprintf(stderr,
"error: Cannot create dir %s\n",
82 len =
strlen(dirname) + 30;
83 filename =
malloc(
sizeof(
char) * len);
85 if (uname(&sysdata) == 0) {
86 len +=
strlen(sysdata.nodename) +
strlen(sysdata.release);
87 filename = realloc(filename,
sizeof(
char) * len);
89 if (filename ==
NULL) {
94 snprintf(filename, len - 1,
"%s/benchmark_%s_%s_%li.log",
95 dirname, sysdata.nodename, sysdata.release,
time(
NULL));
97 snprintf(filename, len - 1,
"%s/benchmark_%li.log",
101 dprintf(
"logilename: %s\n", filename);
103 output = fopen(filename,
"w+");
104 if (output ==
NULL) {
106 fprintf(stderr,
"error: unable to open logfile\n");
109 fprintf(stdout,
"Logfile: %s\n", filename);
112 fprintf(output,
"#round load sleep performance powersave percentage\n");
129 config->
sleep = 500000;
130 config->
load = 500000;
142 #ifdef DEFAULT_CONFIG_FILE
162 FILE *configfile = fopen(path,
"r");
164 if (config ==
NULL) {
165 fprintf(stderr,
"error: config is NULL\n");
169 if (configfile ==
NULL) {
171 fprintf(stderr,
"error: unable to read configfile\n");
176 while (getline(&line, &len, configfile) != -1) {
177 if (line[0] ==
'#' || line[0] ==
' ')
180 sscanf(line,
"%as = %as", &opt, &val);
182 dprintf(
"parsing: %s -> %s\n", opt, val);
211 else if (
strncmp(
"governor", opt, 14) == 0)