add report on child iteration count after reseed
PATCH 1/1 add report on child iteration count after reseed
Signed-off-by Ildar Muslukhov <[email protected]>
--- include/shm.h | 1 + log.c | 16 +++++++++++++--- seed.c | 4 +++- syscall.c | 1 + watchdog.c | 12 +++++++++++- 5 files changed, 29 insertions(+), 5 deletions(-)
include/shm.h +1 -0
@@ -16,6 +16,7 @@ struct shm_s {unsigned long failures;unsigned long previous_count;unsigned long child_syscall_count[MAX_NR_CHILDREN ]; +unsigned long child_syscall_count_after_reseed[MAX_NR_CHILDREN ];unsigned long regenerate;unsigned int seed;
log.c +13 -3
@@ -17,6 +17,7 @@FILE *mainlogfile;bool logfiles_opened = FALSE; +bool log_no_prefix = FALSE;/* Controls prefix output in output function per process */ void open_logfiles (void ) {
@@ -271,7 +272,10 @@ void output(unsigned char level, const char *fmt, ...)/* stdout output if needed */ if (quiet_level > level) { -printf ("%s %s" , prefix, outputbuf); +if (!log_no_prefix) +printf ("%s %s" , prefix, outputbuf); +else +printf ("%s" , outputbuf); (void )fflush (stdout); }
@@ -301,9 +305,15 @@ void output(unsigned char level, const char *fmt, ...) } } monobuf[j] ='\0' ; -fprintf (handle,"%s %s" , prefix, monobuf); +if (!log_no_prefix) +fprintf (handle,"%s %s" , prefix, monobuf); +else +fprintf (handle,"%s" , monobuf); }else { -fprintf (handle,"%s %s" , prefix, outputbuf); +if (!log_no_prefix) +fprintf (handle,"%s %s" , prefix, outputbuf); +else +fprintf (handle,"%s" , outputbuf); } (void )fflush (handle);
seed.c +3 -1
@@ -70,8 +70,10 @@ unsigned int init_seed(unsigned int seedparam)void set_seed (unsigned int pidslot) {pid_t pid =getpid (); -if ((pid != watchdog_pid) && (pid != initpid) && (pid != mainpid)) +if ((pid != watchdog_pid) && (pid != initpid) && (pid != mainpid)) {output (0 ,"Setting seed: %u\n" , shm->seed + (pidslot +1 )); + shm->child_syscall_count_after_reseed[pidslot] =0 ; + }srand (shm->seed + (pidslot +1 )); shm->seeds[pidslot] = shm->seed; }
syscall.c +1 -0
@@ -142,6 +142,7 @@ static unsigned long do_syscall(int childno, int *errno_saved)if (pidslot !=PIDSLOT_NOT_FOUND ) { shm->total_syscalls_done++; shm->child_syscall_count[pidslot]++; + shm->child_syscall_count_after_reseed[pidslot]++; (void )gettimeofday (&shm->tv[pidslot],NULL ); }
watchdog.c +11 -1
@@ -21,6 +21,7 @@#include "child.h" pid_t watchdog_pid; +extern bool log_no_prefix;static int check_shm_sanity (void ) {
@@ -274,6 +275,7 @@ static void watchdog(void)static unsigned long lastcount =0 ;bool watchdog_exit = FALSE;int ret =0 ; +unsigned int j;output (0 ,"Watchdog is alive. (pid:%d)\n" , watchdog_pid);
@@ -305,9 +307,17 @@ static void watchdog(void)if (shm->total_syscalls_done >1 ) {if (shm->total_syscalls_done - lastcount >10000 ) { -output (0 ,"%ld iterations. [F:%ld S:%ld]\n" , +output (0 ,"%ld iterations. [F:%ld S:%ld] " , shm->total_syscalls_done, shm->failures, shm->successes); lastcount = shm->total_syscalls_done; +/* output syscall per child after reseed */ + log_no_prefix = TRUE; +output (0 ,"{" ); +for_each_pidslot (j) { +output (0 ,"C%d:%d;" , j, shm->child_syscall_count_after_reseed[j]); + } +output (0 ,"}\n" ); + log_no_prefix = FALSE; } } }
Signature · 1 line
1.8.4