Add display of major and minor faults
authorJens Axboe <jens.axboe@oracle.com>
Fri, 7 Sep 2007 18:33:33 +0000 (20:33 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 7 Sep 2007 18:33:33 +0000 (20:33 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
stat.c

diff --git a/HOWTO b/HOWTO
index 6ece3c1..d185f8a 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -756,7 +756,7 @@ Client1 (g=0): err= 0:
     slat (msec): min=    0, max=  136, avg= 0.03, stdev= 1.92
     clat (msec): min=    0, max=  631, avg=48.50, stdev=86.82
     bw (KiB/s) : min=    0, max= 1196, per=51.00%, avg=664.02, stdev=681.68
-  cpu        : usr=1.49%, sys=0.25%, ctx=7969
+  cpu        : usr=1.49%, sys=0.25%, ctx=7969, majf=0, minf=17
   IO depths    : 1=0.1%, 2=0.3%, 4=0.5%, 8=99.0%, 16=0.0%, 32=0.0%, >32=0.0%
      issued r/w: total=0/32768, short=0/0
      lat (msec): 2=1.6%, 4=0.0%, 10=3.2%, 20=12.8%, 50=38.4%, 100=24.8%,
@@ -787,7 +787,9 @@ runt=               The runtime of that thread
                only really useful if the threads in this group are on the
                same disk, since they are then competing for disk access.
 cpu=           CPU usage. User and system time, along with the number
-               of context switches this thread went through.
+               of context switches this thread went through, usage of
+               system and user time, and finally the number of major
+               and minor page faults.
 IO depths=     The distribution of io depths over the job life time. The
                numbers are divided into powers of 2, so for example the
                16= entries includes depths up to that value but higher
diff --git a/stat.c b/stat.c
index abb1b15..e858d59 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -61,6 +61,8 @@ void update_rusage_stat(struct thread_data *td)
        ts->usr_time += mtime_since(&ts->ru_start.ru_utime, &ts->ru_end.ru_utime);
        ts->sys_time += mtime_since(&ts->ru_start.ru_stime, &ts->ru_end.ru_stime);
        ts->ctx += ts->ru_end.ru_nvcsw + ts->ru_end.ru_nivcsw - (ts->ru_start.ru_nvcsw + ts->ru_start.ru_nivcsw);
+       ts->minf += ts->ru_end.ru_minflt - ts->ru_start.ru_minflt;
+       ts->majf += ts->ru_end.ru_majflt - ts->ru_start.ru_majflt;
        
        memcpy(&ts->ru_start, &ts->ru_end, sizeof(ts->ru_end));
 }
@@ -318,7 +320,7 @@ static void show_thread_status(struct thread_stat *ts,
                sys_cpu = 0;
        }
 
-       log_info("  cpu          : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu\n", usr_cpu, sys_cpu, ts->ctx);
+       log_info("  cpu          : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu, majf=%lu, minf=%lu\n", usr_cpu, sys_cpu, ts->ctx, ts->majf, ts->minf);
 
        stat_calc_dist(ts, io_u_dist);
        stat_calc_lat_u(ts, io_u_lat_u);
@@ -387,7 +389,7 @@ static void show_thread_status_terse(struct thread_stat *ts,
                sys_cpu = 0;
        }
 
-       log_info(";%f%%;%f%%;%lu", usr_cpu, sys_cpu, ts->ctx);
+       log_info(";%f%%;%f%%;%lu;%lu;%lu", usr_cpu, sys_cpu, ts->ctx, ts->majf, ts->minf);
 
        stat_calc_dist(ts, io_u_dist);
        stat_calc_lat_u(ts, io_u_lat_u);
@@ -531,6 +533,8 @@ void show_run_stats(void)
                ts->usr_time += td->ts.usr_time;
                ts->sys_time += td->ts.sys_time;
                ts->ctx += td->ts.ctx;
+               ts->majf += td->ts.majf;
+               ts->minf += td->ts.minf;
 
                for (k = 0; k < FIO_IO_U_MAP_NR; k++)
                        ts->io_u_map[k] += td->ts.io_u_map[k];