Skip to content

Commit 77909dc

Browse files
committed
Fix 95th calculation
1 parent df7510c commit 77909dc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/rthist.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@ void hist_inc( int transaction, double rtclk )
4343
double hist_ckp( int transaction )
4444
{
4545
int i;
46-
int total,tmp,line;
46+
int total,tmp,line,line_set;
4747

48-
total = tmp = 0;
48+
total = tmp = line_set = 0;
4949
line = MAXREC * REC_PER_SEC;
5050
for( i=0; i<(MAXREC * REC_PER_SEC); i++){
5151
total += cur_hist[transaction][i]*i;
5252
}
53-
for( i=(MAXREC * REC_PER_SEC)-1; i >= 0 ; i--){
53+
for( i=0; i<(MAXREC * REC_PER_SEC); i++){
5454
tmp += cur_hist[transaction][i]*i;
5555
total_hist[transaction][i] += cur_hist[transaction][i];
5656
cur_hist[transaction][i] = 0;
57-
if( tmp <= (total*95/100) ){
57+
if (( tmp >= (total*95/100) ) && (line_set ==0)){
5858
line = i;
59+
line_set=1;
5960
}
6061
}
6162
//printf("CKP: trx: %d line: %d total: %d tmp: %d ret: %.3f\n", transaction, line, total, tmp,(double)(line)/(double)(REC_PER_SEC));

0 commit comments

Comments
 (0)