LCOV - code coverage report
Current view: top level - fs/fscache - histogram.c (source / functions) Hit Total Coverage
Test: gcov_data_raspi2_real_modules_combined.info Lines: 0 27 0.0 %
Date: 2020-09-30 20:25:40 Functions: 0 4 0.0 %
Branches: 0 11 0.0 %

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: GPL-2.0-or-later
       2                 :            : /* FS-Cache latency histogram
       3                 :            :  *
       4                 :            :  * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
       5                 :            :  * Written by David Howells (dhowells@redhat.com)
       6                 :            :  */
       7                 :            : 
       8                 :            : #define FSCACHE_DEBUG_LEVEL THREAD
       9                 :            : #include <linux/module.h>
      10                 :            : #include <linux/proc_fs.h>
      11                 :            : #include <linux/seq_file.h>
      12                 :            : #include "internal.h"
      13                 :            : 
      14                 :            : atomic_t fscache_obj_instantiate_histogram[HZ];
      15                 :            : atomic_t fscache_objs_histogram[HZ];
      16                 :            : atomic_t fscache_ops_histogram[HZ];
      17                 :            : atomic_t fscache_retrieval_delay_histogram[HZ];
      18                 :            : atomic_t fscache_retrieval_histogram[HZ];
      19                 :            : 
      20                 :            : /*
      21                 :            :  * display the time-taken histogram
      22                 :            :  */
      23                 :          0 : static int fscache_histogram_show(struct seq_file *m, void *v)
      24                 :            : {
      25                 :            :         unsigned long index;
      26                 :            :         unsigned n[5], t;
      27                 :            : 
      28      [ #  #  # ]:          0 :         switch ((unsigned long) v) {
      29                 :            :         case 1:
      30                 :          0 :                 seq_puts(m, "JIFS  SECS  OBJ INST  OP RUNS   OBJ RUNS  RETRV DLY RETRIEVLS\n");
      31                 :          0 :                 return 0;
      32                 :            :         case 2:
      33                 :          0 :                 seq_puts(m, "===== ===== ========= ========= ========= ========= =========\n");
      34                 :          0 :                 return 0;
      35                 :            :         default:
      36                 :          0 :                 index = (unsigned long) v - 3;
      37                 :          0 :                 n[0] = atomic_read(&fscache_obj_instantiate_histogram[index]);
      38                 :          0 :                 n[1] = atomic_read(&fscache_ops_histogram[index]);
      39                 :          0 :                 n[2] = atomic_read(&fscache_objs_histogram[index]);
      40                 :          0 :                 n[3] = atomic_read(&fscache_retrieval_delay_histogram[index]);
      41                 :          0 :                 n[4] = atomic_read(&fscache_retrieval_histogram[index]);
      42         [ #  # ]:          0 :                 if (!(n[0] | n[1] | n[2] | n[3] | n[4]))
      43                 :            :                         return 0;
      44                 :            : 
      45                 :          0 :                 t = (index * 1000) / HZ;
      46                 :            : 
      47                 :          0 :                 seq_printf(m, "%4lu  0.%03u %9u %9u %9u %9u %9u\n",
      48                 :            :                            index, t, n[0], n[1], n[2], n[3], n[4]);
      49                 :          0 :                 return 0;
      50                 :            :         }
      51                 :            : }
      52                 :            : 
      53                 :            : /*
      54                 :            :  * set up the iterator to start reading from the first line
      55                 :            :  */
      56                 :          0 : static void *fscache_histogram_start(struct seq_file *m, loff_t *_pos)
      57                 :            : {
      58         [ #  # ]:          0 :         if ((unsigned long long)*_pos >= HZ + 2)
      59                 :            :                 return NULL;
      60         [ #  # ]:          0 :         if (*_pos == 0)
      61                 :          0 :                 *_pos = 1;
      62                 :          0 :         return (void *)(unsigned long) *_pos;
      63                 :            : }
      64                 :            : 
      65                 :            : /*
      66                 :            :  * move to the next line
      67                 :            :  */
      68                 :          0 : static void *fscache_histogram_next(struct seq_file *m, void *v, loff_t *pos)
      69                 :            : {
      70                 :          0 :         (*pos)++;
      71                 :          0 :         return (unsigned long long)*pos > HZ + 2 ?
      72         [ #  # ]:          0 :                 NULL : (void *)(unsigned long) *pos;
      73                 :            : }
      74                 :            : 
      75                 :            : /*
      76                 :            :  * clean up after reading
      77                 :            :  */
      78                 :          0 : static void fscache_histogram_stop(struct seq_file *m, void *v)
      79                 :            : {
      80                 :          0 : }
      81                 :            : 
      82                 :            : const struct seq_operations fscache_histogram_ops = {
      83                 :            :         .start          = fscache_histogram_start,
      84                 :            :         .stop           = fscache_histogram_stop,
      85                 :            :         .next           = fscache_histogram_next,
      86                 :            :         .show           = fscache_histogram_show,
      87                 :            : };

Generated by: LCOV version 1.14