"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-fault.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-fault.c  (stress-ng-0.12.09.tar.xz):stress-fault.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 66 skipping to change at line 66
defined(HAVE_RUSAGE_RU_MINFLT) defined(HAVE_RUSAGE_RU_MINFLT)
struct rusage usage; struct rusage usage;
#endif #endif
char filename[PATH_MAX]; char filename[PATH_MAX];
int ret; int ret;
NOCLOBBER int i; NOCLOBBER int i;
char *start, *end; char *start, *end;
const size_t len = stress_text_addr(&start, &end); const size_t len = stress_text_addr(&start, &end);
const size_t page_size = args->page_size; const size_t page_size = args->page_size;
void *mapto; void *mapto;
#if defined(HAVE_GETRUSAGE) && \
defined(RUSAGE_SELF) && \
defined(HAVE_RUSAGE_RU_MINFLT)
double t1 = 0.0, t2 = 0.0, dt;
#endif
ret = stress_temp_dir_mk_args(args); ret = stress_temp_dir_mk_args(args);
if (ret < 0) if (ret < 0)
return exit_status(-ret); return exit_status(-ret);
(void)stress_temp_filename_args(args, (void)stress_temp_filename_args(args,
filename, sizeof(filename), stress_mwc32()); filename, sizeof(filename), stress_mwc32());
i = 0; i = 0;
if (stress_sighandler(args->name, SIGSEGV, stress_segvhandler, NULL) < 0) if (stress_sighandler(args->name, SIGSEGV, stress_segvhandler, NULL) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
if (stress_sighandler(args->name, SIGBUS, stress_segvhandler, NULL) < 0) if (stress_sighandler(args->name, SIGBUS, stress_segvhandler, NULL) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
mapto = mmap(NULL, page_size, PROT_READ, mapto = mmap(NULL, page_size, PROT_READ,
MAP_ANONYMOUS | MAP_SHARED, -1, 0); MAP_ANONYMOUS | MAP_SHARED, -1, 0);
stress_set_proc_state(args->name, STRESS_STATE_RUN); stress_set_proc_state(args->name, STRESS_STATE_RUN);
#if defined(HAVE_GETRUSAGE) && \
defined(RUSAGE_SELF) && \
defined(HAVE_RUSAGE_RU_MINFLT)
t1 = stress_time_now();
#endif
do { do {
int fd; int fd;
uint8_t *ptr; uint8_t *ptr;
ret = sigsetjmp(jmp_env, 1); ret = sigsetjmp(jmp_env, 1);
if (ret) { if (ret) {
do_jmp = false; do_jmp = false;
pr_err("%s: unexpected segmentation fault\n", pr_err("%s: unexpected segmentation fault\n",
args->name); args->name);
break; break;
skipping to change at line 199 skipping to change at line 209
MAP_ANONYMOUS | MAP_SHARED, -1, 0); MAP_ANONYMOUS | MAP_SHARED, -1, 0);
if (ptr != MAP_FAILED) { if (ptr != MAP_FAILED) {
stress_uint8_put(*ptr); stress_uint8_put(*ptr);
(void)munmap((void *)ptr, page_size); (void)munmap((void *)ptr, page_size);
} }
} }
} }
i++; i++;
inc_counter(args); inc_counter(args);
} while (keep_stressing(args)); } while (keep_stressing(args));
#if defined(HAVE_GETRUSAGE) && \
defined(RUSAGE_SELF) && \
defined(HAVE_RUSAGE_RU_MINFLT)
t2 = stress_time_now();
#endif
/* Clean up, most times this is redundant */ /* Clean up, most times this is redundant */
stress_set_proc_state(args->name, STRESS_STATE_DEINIT); stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
if (mapto != MAP_FAILED) if (mapto != MAP_FAILED)
(void)munmap(mapto, page_size); (void)munmap(mapto, page_size);
(void)unlink(filename); (void)unlink(filename);
(void)stress_temp_dir_rm_args(args); (void)stress_temp_dir_rm_args(args);
#if defined(HAVE_GETRUSAGE) && \ #if defined(HAVE_GETRUSAGE) && \
defined(RUSAGE_SELF) && \ defined(RUSAGE_SELF) && \
defined(HAVE_RUSAGE_RU_MINFLT) defined(HAVE_RUSAGE_RU_MINFLT)
if (!shim_getrusage(RUSAGE_SELF, &usage)) { if (!shim_getrusage(RUSAGE_SELF, &usage)) {
pr_dbg("%s: page faults: minor: %lu, major: %lu\n", pr_dbg("%s: page faults: minor: %lu, major: %lu\n",
args->name, usage.ru_minflt, usage.ru_majflt); args->name, usage.ru_minflt, usage.ru_majflt);
} }
dt = t2 - t1;
if (dt > 0.0) {
stress_misc_stats_set(args->misc_stats, 0, "minor page faults per
sec",
(double)usage.ru_minflt / dt);
stress_misc_stats_set(args->misc_stats, 1, "major page faults per
sec",
(double)usage.ru_majflt / dt);
}
#endif #endif
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
stressor_info_t stress_fault_info = { stressor_info_t stress_fault_info = {
.stressor = stress_fault, .stressor = stress_fault,
.class = CLASS_INTERRUPT | CLASS_SCHEDULER | CLASS_OS, .class = CLASS_INTERRUPT | CLASS_SCHEDULER | CLASS_OS,
.help = help .help = help
}; };
 End of changes. 4 change blocks. 
0 lines changed or deleted 24 lines changed or added

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