"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-memrate.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-memrate.c  (stress-ng-0.12.09.tar.xz):stress-memrate.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 319 skipping to change at line 319
stress_memrate_context_t context; stress_memrate_context_t context;
context.memrate_bytes = DEFAULT_MEMRATE_BYTES; context.memrate_bytes = DEFAULT_MEMRATE_BYTES;
context.memrate_rd_mbs = ~0ULL; context.memrate_rd_mbs = ~0ULL;
context.memrate_wr_mbs = ~0ULL; context.memrate_wr_mbs = ~0ULL;
(void)stress_get_setting("memrate-bytes", &context.memrate_bytes); (void)stress_get_setting("memrate-bytes", &context.memrate_bytes);
(void)stress_get_setting("memrate-rd-mbs", &context.memrate_rd_mbs); (void)stress_get_setting("memrate-rd-mbs", &context.memrate_rd_mbs);
(void)stress_get_setting("memrate-wr-mbs", &context.memrate_wr_mbs); (void)stress_get_setting("memrate-wr-mbs", &context.memrate_wr_mbs);
stats_size = memrate_items * sizeof(stress_memrate_stats_t); stats_size = memrate_items * sizeof(*context.stats);
stats_size = (stats_size + args->page_size - 1) & ~(args->page_size - 1); stats_size = (stats_size + args->page_size - 1) & ~(args->page_size - 1);
context.stats = (stress_memrate_stats_t *)mmap(NULL, stats_size, context.stats = (stress_memrate_stats_t *)mmap(NULL, stats_size,
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (context.stats == MAP_FAILED) if (context.stats == MAP_FAILED)
return EXIT_NO_RESOURCE; return EXIT_NO_RESOURCE;
for (i = 0; i < memrate_items; i++) { for (i = 0; i < memrate_items; i++) {
context.stats[i].duration = 0.0; context.stats[i].duration = 0.0;
context.stats[i].kbytes = 0.0; context.stats[i].kbytes = 0.0;
} }
skipping to change at line 341 skipping to change at line 341
context.memrate_bytes = (context.memrate_bytes + 63) & ~(63ULL); context.memrate_bytes = (context.memrate_bytes + 63) & ~(63ULL);
stress_set_proc_state(args->name, STRESS_STATE_RUN); stress_set_proc_state(args->name, STRESS_STATE_RUN);
rc = stress_oomable_child(args, &context, stress_memrate_child, STRESS_OO MABLE_NORMAL); rc = stress_oomable_child(args, &context, stress_memrate_child, STRESS_OO MABLE_NORMAL);
stress_set_proc_state(args->name, STRESS_STATE_DEINIT); stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
pr_lock(&lock); pr_lock(&lock);
for (i = 0; i < memrate_items; i++) { for (i = 0; i < memrate_items; i++) {
if (context.stats[i].duration > 0.001) if (context.stats[i].duration > 0.001) {
char tmp[32];
const double rate = context.stats[i].kbytes / (context.st
ats[i].duration * KB);
pr_inf_lock(&lock, "%s: %8.8s: %12.2f MB/sec\n", pr_inf_lock(&lock, "%s: %8.8s: %12.2f MB/sec\n",
args->name, memrate_info[i].name, args->name, memrate_info[i].name, rate);
context.stats[i].kbytes / (context.stats[i].durat
ion * KB)); (void)snprintf(tmp, sizeof(tmp), "%s MB/sec", memrate_inf
else o[i].name);
stress_misc_stats_set(args->misc_stats, i, tmp, rate);
} else {
pr_inf_lock(&lock, "%s: %8.8s: interrupted early\n", pr_inf_lock(&lock, "%s: %8.8s: interrupted early\n",
args->name, memrate_info[i].name); args->name, memrate_info[i].name);
}
} }
pr_unlock(&lock); pr_unlock(&lock);
(void)munmap((void *)context.stats, stats_size); (void)munmap((void *)context.stats, stats_size);
return rc; return rc;
} }
static const stress_opt_set_func_t opt_set_funcs[] = { static const stress_opt_set_func_t opt_set_funcs[] = {
{ OPT_memrate_bytes, stress_set_memrate_bytes }, { OPT_memrate_bytes, stress_set_memrate_bytes },
 End of changes. 4 change blocks. 
6 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)