static int dasd_statistics_read(char *page, char **start, off_t off, int count, int *eof, void *data) { unsigned long len; #ifdef CONFIG_DASD_PROFILE struct dasd_profile_info_t *prof; char *str; int shift; /* check for active profiling */ if (dasd_profile_level == DASD_PROFILE_OFF) { len = sprintf(page, "Statistics are off - they might be " "switched on using 'echo set on > " "/proc/dasd/statistics'\n"); return dasd_calc_metrics(page, start, off, count, eof, len); } prof = &dasd_global_profile; /* prevent couter 'overflow' on output */ for (shift = 0; (prof->dasd_io_reqs >> shift) > 9999999; shift++); str = page; str += sprintf(str, "%d dasd I/O requests\n", prof->dasd_io_reqs); str += sprintf(str, "with %d sectors(512B each)\n", prof->dasd_io_sects); str += sprintf(str, " __<4 ___8 __16 __32 __64 _128 " " _256 _512 __1k __2k __4k __8k " " _16k _32k _64k 128k\n"); str += sprintf(str, " _256 _512 __1M __2M __4M __8M " " _16M _32M _64M 128M 256M 512M " " __1G __2G __4G " " _>4G\n"); str += sprintf(str, "Histogram of sizes (512B secs)\n"); str = dasd_statistics_array(str, prof->dasd_io_secs, shift); str += sprintf(str, "Histogram of I/O times (microseconds)\n"); str = dasd_statistics_array(str, prof->dasd_io_times, shift); str += sprintf(str, "Histogram of I/O times per sector\n"); str = dasd_statistics_array(str, prof->dasd_io_timps, shift); str += sprintf(str, "Histogram of I/O time till ssch\n"); str = dasd_statistics_array(str, prof->dasd_io_time1, shift); str += sprintf(str, "Histogram of I/O time between ssch and irq\n"); str = dasd_statistics_array(str, prof->dasd_io_time2, shift); str += sprintf(str, "Histogram of I/O time between ssch " "and irq per sector\n"); str = dasd_statistics_array(str, prof->dasd_io_time2ps, shift); str += sprintf(str, "Histogram of I/O time between irq and end\n"); str = dasd_statistics_array(str, prof->dasd_io_time3, shift); str += sprintf(str, "# of req in chanq at enqueuing (1..32) \n"); str = dasd_statistics_array(str, prof->dasd_io_nr_req, shift); len = str - page; #else len = sprintf(page, "Statistics are not activated in this kernel\n"); #endif return dasd_calc_metrics(page, start, off, count, eof, len); }
static int dasd_stats_proc_show(struct seq_file *m, void *v) { #ifdef CONFIG_DASD_PROFILE struct dasd_profile_info *prof; int factor; spin_lock_bh(&dasd_global_profile.lock); prof = dasd_global_profile.data; if (!prof) { spin_unlock_bh(&dasd_global_profile.lock); seq_printf(m, "Statistics are off - they might be " "switched on using 'echo set on > " "/proc/dasd/statistics'\n"); return 0; } /* prevent counter 'overflow' on output */ for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999; factor *= 10); seq_printf(m, "%d dasd I/O requests\n", prof->dasd_io_reqs); seq_printf(m, "with %u sectors(512B each)\n", prof->dasd_io_sects); seq_printf(m, "Scale Factor is %d\n", factor); seq_printf(m, " __<4 ___8 __16 __32 __64 _128 " " _256 _512 __1k __2k __4k __8k " " _16k _32k _64k 128k\n"); seq_printf(m, " _256 _512 __1M __2M __4M __8M " " _16M _32M _64M 128M 256M 512M " " __1G __2G __4G " " _>4G\n"); seq_printf(m, "Histogram of sizes (512B secs)\n"); dasd_statistics_array(m, prof->dasd_io_secs, factor); seq_printf(m, "Histogram of I/O times (microseconds)\n"); dasd_statistics_array(m, prof->dasd_io_times, factor); seq_printf(m, "Histogram of I/O times per sector\n"); dasd_statistics_array(m, prof->dasd_io_timps, factor); seq_printf(m, "Histogram of I/O time till ssch\n"); dasd_statistics_array(m, prof->dasd_io_time1, factor); seq_printf(m, "Histogram of I/O time between ssch and irq\n"); dasd_statistics_array(m, prof->dasd_io_time2, factor); seq_printf(m, "Histogram of I/O time between ssch " "and irq per sector\n"); dasd_statistics_array(m, prof->dasd_io_time2ps, factor); seq_printf(m, "Histogram of I/O time between irq and end\n"); dasd_statistics_array(m, prof->dasd_io_time3, factor); seq_printf(m, "# of req in chanq at enqueuing (1..32) \n"); dasd_statistics_array(m, prof->dasd_io_nr_req, factor); spin_unlock_bh(&dasd_global_profile.lock); #else seq_printf(m, "Statistics are not activated in this kernel\n"); #endif return 0; }