LCOV - differential code coverage report
Current view: top level - src/backend/utils/activity - pgstat_kind.c (source / functions) Coverage Total Hit GNC
Current: c38de3ae6098ccf1904109f2e550eb4777f66024 vs e352ac8c5c90ed6ce792f044c22145578542a330 Lines: 100.0 % 21 21 21
Current Date: 2026-11-05 14:14:01 +0100 Functions: 100.0 % 1 1 1
Baseline: lcov-20261105-baseline Branches: 100.0 % 6 6 6
Baseline Date: 2026-11-05 14:14:01 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(7,30] days: 100.0 % 3 3 3
(30,360] days: 100.0 % 18 18 18
Function coverage date bins:
(30,360] days: 100.0 % 1 1 1
Branch coverage date bins:
(30,360] days: 100.0 % 6 6 6

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * pgstat_kind.c
                                  4                 :                :  *    Functions related to statistics kinds.
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/backend/utils/activity/pgstat_kind.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : #include "postgres.h"
                                 16                 :                : 
                                 17                 :                : #include "fmgr.h"
                                 18                 :                : #include "funcapi.h"
                                 19                 :                : #include "utils/builtins.h"
                                 20                 :                : #include "utils/fmgrprotos.h"
                                 21                 :                : #include "utils/pgstat_internal.h"
                                 22                 :                : #include "utils/pgstat_kind.h"
                                 23                 :                : #include "utils/tuplestore.h"
                                 24                 :                : 
                                 25                 :                : 
                                 26                 :                : /*
                                 27                 :                :  * pg_stat_get_kind_info
                                 28                 :                :  *
                                 29                 :                :  * Get information about the statistics kinds registered into the system.
                                 30                 :                :  */
                                 31                 :                : Datum
  126 michael@paquier.xyz        32                 :GNC           9 : pg_stat_get_kind_info(PG_FUNCTION_ARGS)
                                 33                 :                : {
                                 34                 :                : #define PG_STAT_KIND_INFO_COLS  8
                                 35                 :                :     ReturnSetInfo *rsinfo;
                                 36                 :                : 
                                 37                 :              9 :     InitMaterializedSRF(fcinfo, 0);
                                 38                 :              9 :     rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
                                 39                 :                : 
                                 40         [ +  + ]:            297 :     for (int kind = PGSTAT_KIND_MIN; kind <= PGSTAT_KIND_MAX; kind++)
                                 41                 :                :     {
                                 42                 :            288 :         Datum       values[PG_STAT_KIND_INFO_COLS] = {0};
                                 43                 :            288 :         bool        nulls[PG_STAT_KIND_INFO_COLS] = {0};
                                 44                 :                :         const PgStat_KindInfo *info;
                                 45                 :                : 
                                 46                 :            288 :         info = pgstat_get_kind_info(kind);
                                 47         [ +  + ]:            288 :         if (info == NULL)
                                 48                 :            152 :             continue;
                                 49                 :                : 
                                 50                 :            136 :         values[0] = Int32GetDatum(kind);
                                 51                 :            136 :         values[1] = CStringGetTextDatum(info->name);
                                 52                 :                : 
                                 53                 :            136 :         values[2] = BoolGetDatum(pgstat_is_kind_builtin(kind));
                                 54                 :            136 :         values[3] = BoolGetDatum(info->fixed_amount);
                                 55                 :            136 :         values[4] = BoolGetDatum(info->accessed_across_databases);
                                 56                 :            136 :         values[5] = BoolGetDatum(info->write_to_file);
   23                            57                 :            136 :         values[6] = BoolGetDatum(info->own_hash);
                                 58                 :                : 
                                 59                 :                :         /*
                                 60                 :                :          * When track_entry_count is disabled, use NULL.  Fixed-sized stats
                                 61                 :                :          * kinds report NULL here.
                                 62                 :                :          */
  126                            63         [ +  + ]:            136 :         if (info->track_entry_count)
   23                            64                 :              5 :             values[7] = Int64GetDatum(pgstat_get_entry_count(kind));
                                 65                 :                :         else
                                 66                 :            131 :             nulls[7] = true;
                                 67                 :                : 
  126                            68                 :            136 :         tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
                                 69                 :                :     }
                                 70                 :                : 
                                 71                 :              9 :     return (Datum) 0;
                                 72                 :                : #undef PG_STAT_KIND_INFO_COLS
                                 73                 :                : }
        

Generated by: LCOV version 2.0-1