[lc-checkins] CVS: linux/fs/proc proc_misc.c,1.2,1.3
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2001-12-13 19:13:00
|
Update of /cvsroot/linuxcompressed/linux/fs/proc In directory usw-pr-cvs1:/tmp/cvs-serv23494/fs/proc Modified Files: proc_misc.c Log Message: First batch of changes to remove #ifdefs and make code cleaner. It follows Documentation/SubmittingPatches document. Index: proc_misc.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/fs/proc/proc_misc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** proc_misc.c 2001/12/12 20:45:46 1.2 --- proc_misc.c 2001/12/13 19:12:57 1.3 *************** *** 37,43 **** #include <linux/smp_lock.h> #include <linux/seq_file.h> - #ifdef CONFIG_COMP_CACHE #include <linux/comp_cache.h> - #endif #include <asm/uaccess.h> --- 37,41 ---- *************** *** 316,396 **** return proc_calc_metrics(page, start, off, count, eof, len); } - - #ifdef CONFIG_COMP_CACHE - void - print_comp_cache_stats(unsigned short alg_idx, char * page, int * length) - { - unsigned int compression_ratio = 0, discard_ratio = 0; - unsigned long long mean_size = 0, mean_comp_cycles = 0, mean_decomp_cycles = 0; - compression_algorithm_t * algorithm = &compression_algorithms[alg_idx]; - stats_summary_t * stats = &algorithm->stats; - - if (!stats->pgccout) { - *length += sprintf(page + *length, "compressed cache statistics\n"); - *length += sprintf(page + *length, "no pages have been compressed with %s%s\n\n", algorithm->name, current_msg); - return; - } - - mean_size = big_division(stats->comp_size_sum, stats->pgccout); - mean_comp_cycles = big_division(stats->comp_cycles_sum, stats->pgccout); - mean_decomp_cycles = big_division(stats->decomp_cycles_sum, stats->pgccout); - compression_ratio = ((big_division(stats->comp_size_sum, stats->pgccout)*100)/PAGE_SIZE); - discard_ratio = (int) ((stats->discarded_pages * 100)/stats->pgccout); - - *length += sprintf(page + *length, "compressed cache - statistics\n"); - *length += sprintf(page + *length, "-- algorithm --\n%s%s\n", algorithm->name, current_msg); - *length += sprintf(page + *length, "-- compressed pages --\n%d\n", stats->pgccout); - *length += sprintf(page + *length, "-- compressed pages faulted in --\n%d\n", stats->pgccin); - - *length += sprintf(page + *length, "-- size --\n"); - *length += sprintf(page + *length, "min | max | mean\n"); - *length += sprintf(page + *length, - " %8d | " - " %8d | " - " %9Lu\n", - (stats->comp_size_min == INF?0:stats->comp_size_min), - stats->comp_size_max, - mean_size); - - *length += sprintf(page + *length, "-- compression cycles --\n"); - *length += sprintf(page + *length, "min | max | mean\n"); - *length += sprintf(page + *length, - "%10lu | " - "%10lu | " - "%11Lu\n", - (stats->comp_cycles_min == INF?0:stats->comp_cycles_min), - stats->comp_cycles_max, - mean_comp_cycles); - - *length += sprintf(page + *length, "-- decompression cycles --\n"); - *length += sprintf(page + *length, "min | max | mean\n"); - *length += sprintf(page + *length, - "%10lu | " - "%10lu | " - "%11Lu\n\n", - (stats->decomp_cycles_min == INF?0:stats->decomp_cycles_min), - stats->decomp_cycles_max, - mean_decomp_cycles); - - *length += sprintf(page + *length, - "compression ratio: %8d%%\n" - "discarded pages: %8d\n" - "discarded ratio: %8d%%\n\n", - compression_ratio, - stats->discarded_pages, - discard_ratio); - } - - static int - comp_cache_stat_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) - { - int length = 0, i; - - for (i = 0; i < NUM_ALGORITHMS; i++) - print_comp_cache_stats(i, page, &length); - - return proc_calc_metrics(page, start, off, count, eof, length); - } - #endif static int devices_read_proc(char *page, char **start, off_t off, --- 314,317 ---- |