diff options
| author | Dominik Brodowski <linux@dominikbrodowski.net> | 2011-04-19 13:20:12 -0400 |
|---|---|---|
| committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2011-07-29 12:35:38 -0400 |
| commit | 02af3cb5aac13d8ef7edb7876260564b7d42ad2b (patch) | |
| tree | 6e5294ee57cb10340bd31301e7b38a29d4a6a054 /tools | |
| parent | f5ac0641d129348399a8f39c95e7a16dc6e19f53 (diff) | |
cpupowerutils: bench - ConfigStyle bugfixes
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/power/cpupower/Makefile | 5 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/benchmark.c | 48 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/benchmark.h | 8 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/config.h | 2 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/main.c | 7 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/parse.c | 37 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/parse.h | 13 | ||||
| -rw-r--r-- | tools/power/cpupower/bench/system.c | 13 |
8 files changed, 75 insertions, 58 deletions
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index fea0e6a0a37a..62c2716a9588 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile | |||
| @@ -38,7 +38,7 @@ NLS ?= true | |||
| 38 | CPUFRQ_BENCH ?= true | 38 | CPUFRQ_BENCH ?= true |
| 39 | 39 | ||
| 40 | # Prefix to the directories we're installing to | 40 | # Prefix to the directories we're installing to |
| 41 | DESTDIR ?= | 41 | DESTDIR ?= |
| 42 | 42 | ||
| 43 | # --- CONFIGURATION END --- | 43 | # --- CONFIGURATION END --- |
| 44 | 44 | ||
| @@ -277,5 +277,4 @@ uninstall: | |||
| 277 | rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo; \ | 277 | rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo; \ |
| 278 | done; | 278 | done; |
| 279 | 279 | ||
| 280 | .PHONY: all utils libcpufreq update-po create-gmo install-lib install-tools install-man install-gmo install uninstall \ | 280 | .PHONY: all utils libcpufreq update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean |
| 281 | clean | ||
diff --git a/tools/power/cpupower/bench/benchmark.c b/tools/power/cpupower/bench/benchmark.c index f538633b8b41..81b1c48607d9 100644 --- a/tools/power/cpupower/bench/benchmark.c +++ b/tools/power/cpupower/bench/benchmark.c | |||
| @@ -37,7 +37,7 @@ if (config->output != stdout) { \ | |||
| 37 | * compute how many rounds of calculation we should do | 37 | * compute how many rounds of calculation we should do |
| 38 | * to get the given load time | 38 | * to get the given load time |
| 39 | * | 39 | * |
| 40 | * @param load aimed load time in µs | 40 | * @param load aimed load time in µs |
| 41 | * | 41 | * |
| 42 | * @retval rounds of calculation | 42 | * @retval rounds of calculation |
| 43 | **/ | 43 | **/ |
| @@ -61,9 +61,8 @@ unsigned int calculate_timespace(long load, struct config *config) | |||
| 61 | timed = (unsigned int)(then - now); | 61 | timed = (unsigned int)(then - now); |
| 62 | 62 | ||
| 63 | /* approximation of the wanted load time by comparing with the | 63 | /* approximation of the wanted load time by comparing with the |
| 64 | * initial calculation time */ | 64 | * initial calculation time */ |
| 65 | for (i= 0; i < 4; i++) | 65 | for (i = 0; i < 4; i++) { |
| 66 | { | ||
| 67 | rounds = (unsigned int)(load * estimated / timed); | 66 | rounds = (unsigned int)(load * estimated / timed); |
| 68 | dprintf("calibrating with %u rounds\n", rounds); | 67 | dprintf("calibrating with %u rounds\n", rounds); |
| 69 | now = get_time(); | 68 | now = get_time(); |
| @@ -102,11 +101,11 @@ void start_benchmark(struct config *config) | |||
| 102 | load_time = config->load; | 101 | load_time = config->load; |
| 103 | 102 | ||
| 104 | /* For the progress bar */ | 103 | /* For the progress bar */ |
| 105 | for (_round=1; _round <= config->rounds; _round++) | 104 | for (_round = 1; _round <= config->rounds; _round++) |
| 106 | total_time += _round * (config->sleep + config->load); | 105 | total_time += _round * (config->sleep + config->load); |
| 107 | total_time *= 2; /* powersave and performance cycles */ | 106 | total_time *= 2; /* powersave and performance cycles */ |
| 108 | 107 | ||
| 109 | for (_round=0; _round < config->rounds; _round++) { | 108 | for (_round = 0; _round < config->rounds; _round++) { |
| 110 | performance_time = 0LL; | 109 | performance_time = 0LL; |
| 111 | powersave_time = 0LL; | 110 | powersave_time = 0LL; |
| 112 | 111 | ||
| @@ -130,9 +129,10 @@ void start_benchmark(struct config *config) | |||
| 130 | fprintf(config->output, "%u %li %li ", | 129 | fprintf(config->output, "%u %li %li ", |
| 131 | _round, load_time, sleep_time); | 130 | _round, load_time, sleep_time); |
| 132 | 131 | ||
| 133 | if (config->verbose) { | 132 | if (config->verbose) |
| 134 | printf("avarage: %lius, rps:%li\n", load_time / calculations, 1000000 * calculations / load_time); | 133 | printf("avarage: %lius, rps:%li\n", |
| 135 | } | 134 | load_time / calculations, |
| 135 | 1000000 * calculations / load_time); | ||
| 136 | 136 | ||
| 137 | /* do some sleep/load cycles with the performance governor */ | 137 | /* do some sleep/load cycles with the performance governor */ |
| 138 | for (cycle = 0; cycle < config->cycles; cycle++) { | 138 | for (cycle = 0; cycle < config->cycles; cycle++) { |
| @@ -142,10 +142,14 @@ void start_benchmark(struct config *config) | |||
| 142 | then = get_time(); | 142 | then = get_time(); |
| 143 | performance_time += then - now - sleep_time; | 143 | performance_time += then - now - sleep_time; |
| 144 | if (config->verbose) | 144 | if (config->verbose) |
| 145 | printf("performance cycle took %lius, sleep: %lius, load: %lius, rounds: %u\n", | 145 | printf("performance cycle took %lius, " |
| 146 | (long)(then - now), sleep_time, load_time, calculations); | 146 | "sleep: %lius, " |
| 147 | "load: %lius, rounds: %u\n", | ||
| 148 | (long)(then - now), sleep_time, | ||
| 149 | load_time, calculations); | ||
| 147 | } | 150 | } |
| 148 | fprintf(config->output, "%li ", performance_time / config->cycles); | 151 | fprintf(config->output, "%li ", |
| 152 | performance_time / config->cycles); | ||
| 149 | 153 | ||
| 150 | progress_time += sleep_time + load_time; | 154 | progress_time += sleep_time + load_time; |
| 151 | show_progress(total_time, progress_time); | 155 | show_progress(total_time, progress_time); |
| @@ -155,7 +159,8 @@ void start_benchmark(struct config *config) | |||
| 155 | if (set_cpufreq_governor(config->governor, config->cpu) != 0) | 159 | if (set_cpufreq_governor(config->governor, config->cpu) != 0) |
| 156 | return; | 160 | return; |
| 157 | 161 | ||
| 158 | /* again, do some sleep/load cycles with the powersave governor */ | 162 | /* again, do some sleep/load cycles with the |
| 163 | * powersave governor */ | ||
| 159 | for (cycle = 0; cycle < config->cycles; cycle++) { | 164 | for (cycle = 0; cycle < config->cycles; cycle++) { |
| 160 | now = get_time(); | 165 | now = get_time(); |
| 161 | usleep(sleep_time); | 166 | usleep(sleep_time); |
| @@ -163,22 +168,27 @@ void start_benchmark(struct config *config) | |||
| 163 | then = get_time(); | 168 | then = get_time(); |
| 164 | powersave_time += then - now - sleep_time; | 169 | powersave_time += then - now - sleep_time; |
| 165 | if (config->verbose) | 170 | if (config->verbose) |
| 166 | printf("powersave cycle took %lius, sleep: %lius, load: %lius, rounds: %u\n", | 171 | printf("powersave cycle took %lius, " |
| 167 | (long)(then - now), sleep_time, load_time, calculations); | 172 | "sleep: %lius, " |
| 173 | "load: %lius, rounds: %u\n", | ||
| 174 | (long)(then - now), sleep_time, | ||
| 175 | load_time, calculations); | ||
| 168 | } | 176 | } |
| 169 | 177 | ||
| 170 | progress_time += sleep_time + load_time; | 178 | progress_time += sleep_time + load_time; |
| 171 | 179 | ||
| 172 | /* compare the avarage sleep/load cycles */ | 180 | /* compare the avarage sleep/load cycles */ |
| 173 | fprintf(config->output, "%li ", powersave_time / config->cycles); | 181 | fprintf(config->output, "%li ", |
| 174 | fprintf(config->output, "%.3f\n", performance_time * 100.0 / powersave_time); | 182 | powersave_time / config->cycles); |
| 183 | fprintf(config->output, "%.3f\n", | ||
| 184 | performance_time * 100.0 / powersave_time); | ||
| 175 | fflush(config->output); | 185 | fflush(config->output); |
| 176 | 186 | ||
| 177 | if (config->verbose) | 187 | if (config->verbose) |
| 178 | printf("performance is at %.2f%%\n", performance_time * 100.0 / powersave_time); | 188 | printf("performance is at %.2f%%\n", |
| 189 | performance_time * 100.0 / powersave_time); | ||
| 179 | 190 | ||
| 180 | sleep_time += config->sleep_step; | 191 | sleep_time += config->sleep_step; |
| 181 | load_time += config->load_step; | 192 | load_time += config->load_step; |
| 182 | } | 193 | } |
| 183 | } | 194 | } |
| 184 | |||
diff --git a/tools/power/cpupower/bench/benchmark.h b/tools/power/cpupower/bench/benchmark.h index 0691f91b720b..51d7f50ac2bb 100644 --- a/tools/power/cpupower/bench/benchmark.h +++ b/tools/power/cpupower/bench/benchmark.h | |||
| @@ -19,9 +19,11 @@ | |||
| 19 | 19 | ||
| 20 | /* load loop, this schould take about 1 to 2ms to complete */ | 20 | /* load loop, this schould take about 1 to 2ms to complete */ |
| 21 | #define ROUNDS(x) {unsigned int rcnt; \ | 21 | #define ROUNDS(x) {unsigned int rcnt; \ |
| 22 | for (rcnt = 0; rcnt< x*1000; rcnt++) { \ | 22 | for (rcnt = 0; rcnt < x*1000; rcnt++) { \ |
| 23 | (void)(((int)(pow(rcnt, rcnt) * sqrt(rcnt*7230970)) ^ 7230716) ^ (int)atan2(rcnt, rcnt)); \ | 23 | (void)(((int)(pow(rcnt, rcnt) * \ |
| 24 | }} \ | 24 | sqrt(rcnt*7230970)) ^ 7230716) ^ \ |
| 25 | (int)atan2(rcnt, rcnt)); \ | ||
| 26 | } } \ | ||
| 25 | 27 | ||
| 26 | 28 | ||
| 27 | void start_benchmark(struct config *config); | 29 | void start_benchmark(struct config *config); |
diff --git a/tools/power/cpupower/bench/config.h b/tools/power/cpupower/bench/config.h index 9690f1be32fd..ee6f258e5336 100644 --- a/tools/power/cpupower/bench/config.h +++ b/tools/power/cpupower/bench/config.h | |||
| @@ -31,6 +31,6 @@ | |||
| 31 | #ifdef DEBUG | 31 | #ifdef DEBUG |
| 32 | #define dprintf printf | 32 | #define dprintf printf |
| 33 | #else | 33 | #else |
| 34 | #define dprintf( ... ) while(0) { } | 34 | #define dprintf(...) do { } while (0) |
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
diff --git a/tools/power/cpupower/bench/main.c b/tools/power/cpupower/bench/main.c index 60953fc93431..24910313a521 100644 --- a/tools/power/cpupower/bench/main.c +++ b/tools/power/cpupower/bench/main.c | |||
| @@ -28,8 +28,7 @@ | |||
| 28 | #include "system.h" | 28 | #include "system.h" |
| 29 | #include "benchmark.h" | 29 | #include "benchmark.h" |
| 30 | 30 | ||
| 31 | static struct option long_options[] = | 31 | static struct option long_options[] = { |
| 32 | { | ||
| 33 | {"output", 1, 0, 'o'}, | 32 | {"output", 1, 0, 'o'}, |
| 34 | {"sleep", 1, 0, 's'}, | 33 | {"sleep", 1, 0, 's'}, |
| 35 | {"load", 1, 0, 'l'}, | 34 | {"load", 1, 0, 'l'}, |
| @@ -50,7 +49,7 @@ static struct option long_options[] = | |||
| 50 | usage | 49 | usage |
| 51 | *******************************************************************/ | 50 | *******************************************************************/ |
| 52 | 51 | ||
| 53 | void usage() | 52 | void usage() |
| 54 | { | 53 | { |
| 55 | printf("usage: ./bench\n"); | 54 | printf("usage: ./bench\n"); |
| 56 | printf("Options:\n"); | 55 | printf("Options:\n"); |
| @@ -67,7 +66,7 @@ void usage() | |||
| 67 | printf(" -o, --output=<dir>\t\t\toutput path. Filename will be OUTPUTPATH/benchmark_TIMESTAMP.log\n"); | 66 | printf(" -o, --output=<dir>\t\t\toutput path. Filename will be OUTPUTPATH/benchmark_TIMESTAMP.log\n"); |
| 68 | printf(" -v, --verbose\t\t\t\tverbose output on/off\n"); | 67 | printf(" -v, --verbose\t\t\t\tverbose output on/off\n"); |
| 69 | printf(" -h, --help\t\t\t\tPrint this help screen\n"); | 68 | printf(" -h, --help\t\t\t\tPrint this help screen\n"); |
| 70 | exit (1); | 69 | exit(1); |
| 71 | } | 70 | } |
| 72 | 71 | ||
| 73 | /******************************************************************* | 72 | /******************************************************************* |
diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index 3b270ac92c46..543bba14ae2c 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c | |||
| @@ -86,20 +86,22 @@ FILE *prepare_output(const char *dirname) | |||
| 86 | len += strlen(sysdata.nodename) + strlen(sysdata.release); | 86 | len += strlen(sysdata.nodename) + strlen(sysdata.release); |
| 87 | filename = realloc(filename, sizeof(char) * len); | 87 | filename = realloc(filename, sizeof(char) * len); |
| 88 | 88 | ||
| 89 | if(filename == NULL) { | 89 | if (filename == NULL) { |
| 90 | perror("realloc"); | 90 | perror("realloc"); |
| 91 | return NULL; | 91 | return NULL; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | snprintf(filename, len - 1, "%s/benchmark_%s_%s_%li.log", | 94 | snprintf(filename, len - 1, "%s/benchmark_%s_%s_%li.log", |
| 95 | dirname, sysdata.nodename, sysdata.release, time(NULL)); | 95 | dirname, sysdata.nodename, sysdata.release, time(NULL)); |
| 96 | } else { | 96 | } else { |
| 97 | snprintf(filename, len -1, "%s/benchmark_%li.log", dirname, time(NULL)); | 97 | snprintf(filename, len - 1, "%s/benchmark_%li.log", |
| 98 | dirname, time(NULL)); | ||
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | dprintf("logilename: %s\n", filename); | 101 | dprintf("logilename: %s\n", filename); |
| 101 | 102 | ||
| 102 | if ((output = fopen(filename, "w+")) == NULL) { | 103 | output = fopen(filename, "w+"); |
| 104 | if (output == NULL) { | ||
| 103 | perror("fopen"); | 105 | perror("fopen"); |
| 104 | fprintf(stderr, "error: unable to open logfile\n"); | 106 | fprintf(stderr, "error: unable to open logfile\n"); |
| 105 | } | 107 | } |
| @@ -130,7 +132,7 @@ struct config *prepare_default_config() | |||
| 130 | config->load_step = 500000; | 132 | config->load_step = 500000; |
| 131 | config->cycles = 5; | 133 | config->cycles = 5; |
| 132 | config->rounds = 50; | 134 | config->rounds = 50; |
| 133 | config->cpu = 0; | 135 | config->cpu = 0; |
| 134 | config->prio = SCHED_HIGH; | 136 | config->prio = SCHED_HIGH; |
| 135 | config->verbose = 0; | 137 | config->verbose = 0; |
| 136 | strncpy(config->governor, "ondemand", 8); | 138 | strncpy(config->governor, "ondemand", 8); |
| @@ -166,13 +168,12 @@ int prepare_config(const char *path, struct config *config) | |||
| 166 | 168 | ||
| 167 | if (configfile == NULL) { | 169 | if (configfile == NULL) { |
| 168 | perror("fopen"); | 170 | perror("fopen"); |
| 169 | fprintf(stderr, "error: unable to read configfile\n"); | 171 | fprintf(stderr, "error: unable to read configfile\n"); |
| 170 | free(config); | 172 | free(config); |
| 171 | return 1; | 173 | return 1; |
| 172 | } | 174 | } |
| 173 | 175 | ||
| 174 | while (getline(&line, &len, configfile) != -1) | 176 | while (getline(&line, &len, configfile) != -1) { |
| 175 | { | ||
| 176 | if (line[0] == '#' || line[0] == ' ') | 177 | if (line[0] == '#' || line[0] == ' ') |
| 177 | continue; | 178 | continue; |
| 178 | 179 | ||
| @@ -183,35 +184,35 @@ int prepare_config(const char *path, struct config *config) | |||
| 183 | if (strncmp("sleep", opt, strlen(opt)) == 0) | 184 | if (strncmp("sleep", opt, strlen(opt)) == 0) |
| 184 | sscanf(val, "%li", &config->sleep); | 185 | sscanf(val, "%li", &config->sleep); |
| 185 | 186 | ||
| 186 | else if (strncmp("load", opt, strlen(opt)) == 0) | 187 | else if (strncmp("load", opt, strlen(opt)) == 0) |
| 187 | sscanf(val, "%li", &config->load); | 188 | sscanf(val, "%li", &config->load); |
| 188 | 189 | ||
| 189 | else if (strncmp("load_step", opt, strlen(opt)) == 0) | 190 | else if (strncmp("load_step", opt, strlen(opt)) == 0) |
| 190 | sscanf(val, "%li", &config->load_step); | 191 | sscanf(val, "%li", &config->load_step); |
| 191 | 192 | ||
| 192 | else if (strncmp("sleep_step", opt, strlen(opt)) == 0) | 193 | else if (strncmp("sleep_step", opt, strlen(opt)) == 0) |
| 193 | sscanf(val, "%li", &config->sleep_step); | 194 | sscanf(val, "%li", &config->sleep_step); |
| 194 | 195 | ||
| 195 | else if (strncmp("cycles", opt, strlen(opt)) == 0) | 196 | else if (strncmp("cycles", opt, strlen(opt)) == 0) |
| 196 | sscanf(val, "%u", &config->cycles); | 197 | sscanf(val, "%u", &config->cycles); |
| 197 | 198 | ||
| 198 | else if (strncmp("rounds", opt, strlen(opt)) == 0) | 199 | else if (strncmp("rounds", opt, strlen(opt)) == 0) |
| 199 | sscanf(val, "%u", &config->rounds); | 200 | sscanf(val, "%u", &config->rounds); |
| 200 | 201 | ||
| 201 | else if (strncmp("verbose", opt, strlen(opt)) == 0) | 202 | else if (strncmp("verbose", opt, strlen(opt)) == 0) |
| 202 | sscanf(val, "%u", &config->verbose); | 203 | sscanf(val, "%u", &config->verbose); |
| 203 | 204 | ||
| 204 | else if (strncmp("output", opt, strlen(opt)) == 0) | 205 | else if (strncmp("output", opt, strlen(opt)) == 0) |
| 205 | config->output = prepare_output(val); | 206 | config->output = prepare_output(val); |
| 206 | 207 | ||
| 207 | else if (strncmp("cpu", opt, strlen(opt)) == 0) | 208 | else if (strncmp("cpu", opt, strlen(opt)) == 0) |
| 208 | sscanf(val, "%u", &config->cpu); | 209 | sscanf(val, "%u", &config->cpu); |
| 209 | 210 | ||
| 210 | else if (strncmp("governor", opt, 14) == 0) | 211 | else if (strncmp("governor", opt, 14) == 0) |
| 211 | strncpy(config->governor, val, 14); | 212 | strncpy(config->governor, val, 14); |
| 212 | 213 | ||
| 213 | else if (strncmp("priority", opt, strlen(opt)) == 0) { | 214 | else if (strncmp("priority", opt, strlen(opt)) == 0) { |
| 214 | if (string_to_prio(val) != SCHED_ERR) | 215 | if (string_to_prio(val) != SCHED_ERR) |
| 215 | config->prio = string_to_prio(val); | 216 | config->prio = string_to_prio(val); |
| 216 | } | 217 | } |
| 217 | } | 218 | } |
diff --git a/tools/power/cpupower/bench/parse.h b/tools/power/cpupower/bench/parse.h index 9fcdfa23dd9c..a8dc632d9eee 100644 --- a/tools/power/cpupower/bench/parse.h +++ b/tools/power/cpupower/bench/parse.h | |||
| @@ -20,19 +20,22 @@ | |||
| 20 | /* struct that holds the required config parameters */ | 20 | /* struct that holds the required config parameters */ |
| 21 | struct config | 21 | struct config |
| 22 | { | 22 | { |
| 23 | long sleep; /* sleep time in µs */ | 23 | long sleep; /* sleep time in µs */ |
| 24 | long load; /* load time in µs */ | 24 | long load; /* load time in µs */ |
| 25 | long sleep_step; /* time value which changes the | 25 | long sleep_step; /* time value which changes the |
| 26 | * sleep time after every round in µs */ | 26 | * sleep time after every round in µs */ |
| 27 | long load_step; /* time value which changes the | 27 | long load_step; /* time value which changes the |
| 28 | * load time after every round in µs */ | 28 | * load time after every round in µs */ |
| 29 | unsigned int cycles; /* calculation cycles with the same sleep/load time */ | 29 | unsigned int cycles; /* calculation cycles with the same sleep/load time */ |
| 30 | unsigned int rounds; /* calculation rounds with iterated sleep/load time */ | 30 | unsigned int rounds; /* calculation rounds with iterated sleep/load time */ |
| 31 | unsigned int cpu; /* cpu for which the affinity is set */ | 31 | unsigned int cpu; /* cpu for which the affinity is set */ |
| 32 | char governor[15]; /* cpufreq governor */ | 32 | char governor[15]; /* cpufreq governor */ |
| 33 | enum sched_prio /* possible scheduler priorities */ | 33 | enum sched_prio /* possible scheduler priorities */ |
| 34 | { | 34 | { |
| 35 | SCHED_ERR=-1,SCHED_HIGH, SCHED_DEFAULT, SCHED_LOW | 35 | SCHED_ERR = -1, |
| 36 | SCHED_HIGH, | ||
| 37 | SCHED_DEFAULT, | ||
| 38 | SCHED_LOW | ||
| 36 | } prio; | 39 | } prio; |
| 37 | 40 | ||
| 38 | unsigned int verbose; /* verbose output */ | 41 | unsigned int verbose; /* verbose output */ |
diff --git a/tools/power/cpupower/bench/system.c b/tools/power/cpupower/bench/system.c index 3e3a82e8bdd9..f01e3f4be84c 100644 --- a/tools/power/cpupower/bench/system.c +++ b/tools/power/cpupower/bench/system.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include "system.h" | 31 | #include "system.h" |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * returns time since epoch in µs | 34 | * returns time since epoch in µs |
| 35 | * | 35 | * |
| 36 | * @retval time | 36 | * @retval time |
| 37 | **/ | 37 | **/ |
| @@ -87,7 +87,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu) | |||
| 87 | int set_cpu_affinity(unsigned int cpu) | 87 | int set_cpu_affinity(unsigned int cpu) |
| 88 | { | 88 | { |
| 89 | cpu_set_t cpuset; | 89 | cpu_set_t cpuset; |
| 90 | 90 | ||
| 91 | CPU_ZERO(&cpuset); | 91 | CPU_ZERO(&cpuset); |
| 92 | CPU_SET(cpu, &cpuset); | 92 | CPU_SET(cpu, &cpuset); |
| 93 | 93 | ||
| @@ -129,7 +129,7 @@ int set_process_priority(int priority) | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | /** | 131 | /** |
| 132 | * notifys the user that the benchmark may run some time | 132 | * notifies the user that the benchmark may run some time |
| 133 | * | 133 | * |
| 134 | * @param config benchmark config values | 134 | * @param config benchmark config values |
| 135 | * | 135 | * |
| @@ -142,8 +142,11 @@ void prepare_user(const struct config *config) | |||
| 142 | unsigned int round; | 142 | unsigned int round; |
| 143 | 143 | ||
| 144 | for (round = 0; round < config->rounds; round++) { | 144 | for (round = 0; round < config->rounds; round++) { |
| 145 | sleep_time += 2 * config->cycles * (config->sleep + config->sleep_step * round); | 145 | sleep_time += 2 * config->cycles * |
| 146 | load_time += 2 * config->cycles * (config->load + config->load_step * round) + (config->load + config->load_step * round * 4); | 146 | (config->sleep + config->sleep_step * round); |
| 147 | load_time += 2 * config->cycles * | ||
| 148 | (config->load + config->load_step * round) + | ||
| 149 | (config->load + config->load_step * round * 4); | ||
| 147 | } | 150 | } |
| 148 | 151 | ||
| 149 | if (config->verbose || config->output != stdout) | 152 | if (config->verbose || config->output != stdout) |
