Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc87f31

Browse files
author
Marina Polyakova
committed
Code cleanup 4
1 parentf76ad49 commitbc87f31

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -799,31 +799,34 @@ initStats(StatsData *sd, double start_time)
799799
}
800800

801801
/*
802-
* Accumulate one additional item into the given stats object.
802+
* Accumulate statistics regardless of whether there was a failure / transaction
803+
* was skipped or not.
803804
*/
804805
staticvoid
805-
accumStats(StatsData*stats,boolskipped,boolserialization_failure,
806-
booldeadlock_failure,doublelat,doublelag,SimpleStats*attempts)
806+
accumMainStats(StatsData*stats,boolskipped,boolserialization_failure,
807+
booldeadlock_failure,SimpleStats*attempts)
807808
{
808809
stats->cnt++;
809-
mergeSimpleStats(&stats->attempts,attempts);
810-
811810
if (skipped)
812-
{
813-
/* no latency to record on skipped transactions */
814811
stats->skipped++;
815-
}
816812
elseif (serialization_failure)
817-
{
818-
/* no latency to record on transactions with serialization failures */
819813
stats->serialization_failures++;
820-
}
821814
elseif (deadlock_failure)
822-
{
823-
/* no latency to record on transactions with deadlock failures */
824815
stats->deadlock_failures++;
825-
}
826-
else
816+
mergeSimpleStats(&stats->attempts,attempts);
817+
}
818+
819+
/*
820+
* Accumulate one additional item into the given stats object.
821+
*/
822+
staticvoid
823+
accumStats(StatsData*stats,boolskipped,boolserialization_failure,
824+
booldeadlock_failure,doublelat,doublelag,SimpleStats*attempts)
825+
{
826+
accumMainStats(stats,skipped,serialization_failure,deadlock_failure,
827+
attempts);
828+
829+
if (!skipped&& !serialization_failure&& !deadlock_failure)
827830
{
828831
addToSimpleStats(&stats->latency,lat);
829832

@@ -2168,18 +2171,11 @@ doCustom(TState *thread, CState *st, StatsData *agg)
21682171
{
21692172
if (progress||throttle_delay||latency_limit||
21702173
per_script_stats||use_log)
2171-
{
21722174
processXactStats(thread,st,&now, false,agg);
2173-
}
21742175
else
2175-
{
2176-
thread->stats.cnt++;
2177-
if (st->serialization_failure)
2178-
thread->stats.serialization_failures++;
2179-
if (st->deadlock_failure)
2180-
thread->stats.deadlock_failures++;
2181-
mergeSimpleStats(&thread->stats.attempts,&st->attempts);
2182-
}
2176+
accumMainStats(&thread->stats, false,
2177+
st->serialization_failure,st->deadlock_failure,
2178+
&st->attempts);
21832179
}
21842180

21852181
if (commands[st->state]->type==SQL_COMMAND)
@@ -2696,14 +2692,8 @@ processXactStats(TState *thread, CState *st, instr_time *now,
26962692
thread->latency_late++;
26972693
}
26982694
else
2699-
{
2700-
thread->stats.cnt++;
2701-
if (st->serialization_failure)
2702-
thread->stats.serialization_failures++;
2703-
if (st->deadlock_failure)
2704-
thread->stats.deadlock_failures++;
2705-
mergeSimpleStats(&thread->stats.attempts,&st->attempts);
2706-
}
2695+
accumMainStats(&thread->stats,skipped,st->serialization_failure,
2696+
st->deadlock_failure,&st->attempts);
27072697

27082698
if (use_log)
27092699
doLog(thread,st,now,agg,skipped,latency,lag);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp