1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00

Rename fields in pgstat structures for functions and relations

This commit renames the members of a few pgstat structures related to
functions and relations, by respectively removing their prefix "f_" and
"t_".  The statistics for functions and relations and handled in their
own file, and pgstatfuncs.c associates each field in a structure
variable named based on the object type handled, so no information is
lost with this rename.

This will help with some of the refactoring aimed for pgstatfuncs.c, as
this makes more consistent the field names with the SQL functions
retrieving them.

Author: Bertrand Drouvot
Reviewed-by: Michael Paquier, Melanie Plageman
Discussion: https://postgr.es/m/9142f62a-a422-145c-bde0-b5bc498a4ada@gmail.com
This commit is contained in:
Michael Paquier
2023-03-24 08:46:29 +09:00
parent 11a0a8b529
commit 8089517ab8
4 changed files with 142 additions and 142 deletions

View File

@ -149,7 +149,7 @@ pg_stat_get_function_calls(PG_FUNCTION_ARGS)
if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL)
PG_RETURN_NULL();
PG_RETURN_INT64(funcentry->f_numcalls);
PG_RETURN_INT64(funcentry->numcalls);
}
Datum
@ -161,7 +161,7 @@ pg_stat_get_function_total_time(PG_FUNCTION_ARGS)
if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL)
PG_RETURN_NULL();
/* convert counter from microsec to millisec for display */
PG_RETURN_FLOAT8(((double) funcentry->f_total_time) / 1000.0);
PG_RETURN_FLOAT8(((double) funcentry->total_time) / 1000.0);
}
Datum
@ -173,7 +173,7 @@ pg_stat_get_function_self_time(PG_FUNCTION_ARGS)
if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL)
PG_RETURN_NULL();
/* convert counter from microsec to millisec for display */
PG_RETURN_FLOAT8(((double) funcentry->f_self_time) / 1000.0);
PG_RETURN_FLOAT8(((double) funcentry->self_time) / 1000.0);
}
Datum
@ -1508,7 +1508,7 @@ pg_stat_get_xact_numscans(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_numscans);
result = (int64) (tabentry->counts.numscans);
PG_RETURN_INT64(result);
}
@ -1523,7 +1523,7 @@ pg_stat_get_xact_tuples_returned(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_tuples_returned);
result = (int64) (tabentry->counts.tuples_returned);
PG_RETURN_INT64(result);
}
@ -1538,7 +1538,7 @@ pg_stat_get_xact_tuples_fetched(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_tuples_fetched);
result = (int64) (tabentry->counts.tuples_fetched);
PG_RETURN_INT64(result);
}
@ -1555,8 +1555,8 @@ pg_stat_get_xact_tuples_inserted(PG_FUNCTION_ARGS)
result = 0;
else
{
result = tabentry->t_counts.t_tuples_inserted;
/* live subtransactions' counts aren't in t_tuples_inserted yet */
result = tabentry->counts.tuples_inserted;
/* live subtransactions' counts aren't in tuples_inserted yet */
for (trans = tabentry->trans; trans != NULL; trans = trans->upper)
result += trans->tuples_inserted;
}
@ -1576,8 +1576,8 @@ pg_stat_get_xact_tuples_updated(PG_FUNCTION_ARGS)
result = 0;
else
{
result = tabentry->t_counts.t_tuples_updated;
/* live subtransactions' counts aren't in t_tuples_updated yet */
result = tabentry->counts.tuples_updated;
/* live subtransactions' counts aren't in tuples_updated yet */
for (trans = tabentry->trans; trans != NULL; trans = trans->upper)
result += trans->tuples_updated;
}
@ -1597,8 +1597,8 @@ pg_stat_get_xact_tuples_deleted(PG_FUNCTION_ARGS)
result = 0;
else
{
result = tabentry->t_counts.t_tuples_deleted;
/* live subtransactions' counts aren't in t_tuples_deleted yet */
result = tabentry->counts.tuples_deleted;
/* live subtransactions' counts aren't in tuples_deleted yet */
for (trans = tabentry->trans; trans != NULL; trans = trans->upper)
result += trans->tuples_deleted;
}
@ -1616,7 +1616,7 @@ pg_stat_get_xact_tuples_hot_updated(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_tuples_hot_updated);
result = (int64) (tabentry->counts.tuples_hot_updated);
PG_RETURN_INT64(result);
}
@ -1631,7 +1631,7 @@ pg_stat_get_xact_tuples_newpage_updated(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_tuples_newpage_updated);
result = (int64) (tabentry->counts.tuples_newpage_updated);
PG_RETURN_INT64(result);
}
@ -1646,7 +1646,7 @@ pg_stat_get_xact_blocks_fetched(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_blocks_fetched);
result = (int64) (tabentry->counts.blocks_fetched);
PG_RETURN_INT64(result);
}
@ -1661,7 +1661,7 @@ pg_stat_get_xact_blocks_hit(PG_FUNCTION_ARGS)
if ((tabentry = find_tabstat_entry(relid)) == NULL)
result = 0;
else
result = (int64) (tabentry->t_counts.t_blocks_hit);
result = (int64) (tabentry->counts.blocks_hit);
PG_RETURN_INT64(result);
}
@ -1674,7 +1674,7 @@ pg_stat_get_xact_function_calls(PG_FUNCTION_ARGS)
if ((funcentry = find_funcstat_entry(funcid)) == NULL)
PG_RETURN_NULL();
PG_RETURN_INT64(funcentry->f_numcalls);
PG_RETURN_INT64(funcentry->numcalls);
}
Datum
@ -1685,7 +1685,7 @@ pg_stat_get_xact_function_total_time(PG_FUNCTION_ARGS)
if ((funcentry = find_funcstat_entry(funcid)) == NULL)
PG_RETURN_NULL();
PG_RETURN_FLOAT8(INSTR_TIME_GET_MILLISEC(funcentry->f_total_time));
PG_RETURN_FLOAT8(INSTR_TIME_GET_MILLISEC(funcentry->total_time));
}
Datum
@ -1696,7 +1696,7 @@ pg_stat_get_xact_function_self_time(PG_FUNCTION_ARGS)
if ((funcentry = find_funcstat_entry(funcid)) == NULL)
PG_RETURN_NULL();
PG_RETURN_FLOAT8(INSTR_TIME_GET_MILLISEC(funcentry->f_self_time));
PG_RETURN_FLOAT8(INSTR_TIME_GET_MILLISEC(funcentry->self_time));
}