|
5 | 5 | *
|
6 | 6 | *Copyright (c) 2001, PostgreSQL Global Development Group
|
7 | 7 | *
|
8 |
| - * $Id: pgstat.h,v 1.2 2001/06/2916:29:37 wieck Exp $ |
| 8 | + * $Id: pgstat.h,v 1.3 2001/06/2923:03:02 tgl Exp $ |
9 | 9 | * ----------
|
10 | 10 | */
|
11 | 11 | #ifndefPGSTAT_H
|
@@ -349,61 +349,83 @@ extern voidpgstat_initstats(PgStat_Info *stats, Relation rel);
|
349 | 349 |
|
350 | 350 |
|
351 | 351 | #definepgstat_reset_heap_scan(s)\
|
352 |
| -if ((s)->tabentry != NULL)\ |
353 |
| -(s)->heap_scan_counted = FALSE |
| 352 | +do {\ |
| 353 | +if ((s)->tabentry != NULL)\ |
| 354 | +(s)->heap_scan_counted = FALSE;\ |
| 355 | +} while (0) |
354 | 356 | #definepgstat_count_heap_scan(s)\
|
355 |
| -if ((s)->tabentry != NULL && !(s)->heap_scan_counted) {\ |
356 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_numscans++;\ |
357 |
| -(s)->heap_scan_counted = TRUE;\ |
358 |
| -} |
| 357 | +do {\ |
| 358 | +if ((s)->tabentry != NULL && !(s)->heap_scan_counted) {\ |
| 359 | +((PgStat_TableEntry *)((s)->tabentry))->t_numscans++;\ |
| 360 | +(s)->heap_scan_counted = TRUE;\ |
| 361 | +}\ |
| 362 | +} while (0) |
359 | 363 | #definepgstat_count_heap_getnext(s)\
|
360 |
| -if ((s)->tabentry != NULL)\ |
361 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++ |
| 364 | +do {\ |
| 365 | +if ((s)->tabentry != NULL)\ |
| 366 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++; \ |
| 367 | +} while (0) |
362 | 368 | #definepgstat_count_heap_fetch(s)\
|
363 |
| -if ((s)->tabentry != NULL)\ |
364 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_fetched++ |
| 369 | +do {\ |
| 370 | +if ((s)->tabentry != NULL)\ |
| 371 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_fetched++;\ |
| 372 | +} while (0) |
365 | 373 | #definepgstat_count_heap_insert(s)\
|
366 |
| -if ((s)->tabentry != NULL)\ |
367 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_inserted++ |
| 374 | +do {\ |
| 375 | +if ((s)->tabentry != NULL)\ |
| 376 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_inserted++; \ |
| 377 | +} while (0) |
368 | 378 | #definepgstat_count_heap_update(s)\
|
369 |
| -if ((s)->tabentry != NULL)\ |
370 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_updated++ |
| 379 | +do {\ |
| 380 | +if ((s)->tabentry != NULL)\ |
| 381 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_updated++;\ |
| 382 | +} while (0) |
371 | 383 | #definepgstat_count_heap_delete(s)\
|
372 |
| -if ((s)->tabentry != NULL)\ |
373 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++ |
374 |
| - |
| 384 | +do {\ |
| 385 | +if ((s)->tabentry != NULL)\ |
| 386 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++;\ |
| 387 | +} while (0) |
375 | 388 | #definepgstat_reset_index_scan(s)\
|
376 |
| -if ((s)->tabentry != NULL)\ |
377 |
| -(s)->index_scan_counted = FALSE |
| 389 | +do {\ |
| 390 | +if ((s)->tabentry != NULL)\ |
| 391 | +(s)->index_scan_counted = FALSE;\ |
| 392 | +} while (0) |
378 | 393 | #definepgstat_count_index_scan(s)\
|
379 |
| -if ((s)->tabentry != NULL && !(s)->index_scan_counted) {\ |
380 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_numscans++;\ |
381 |
| -(s)->index_scan_counted = TRUE;\ |
382 |
| -} |
| 394 | +do {\ |
| 395 | +if ((s)->tabentry != NULL && !(s)->index_scan_counted) {\ |
| 396 | +((PgStat_TableEntry *)((s)->tabentry))->t_numscans++;\ |
| 397 | +(s)->index_scan_counted = TRUE;\ |
| 398 | +}\ |
| 399 | +} while (0) |
383 | 400 | #definepgstat_count_index_getnext(s)\
|
384 |
| -if ((s)->tabentry != NULL)\ |
385 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++ |
386 |
| - |
| 401 | +do {\ |
| 402 | +if ((s)->tabentry != NULL)\ |
| 403 | +((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++; \ |
| 404 | +} while (0) |
387 | 405 | #definepgstat_count_buffer_read(s,r)\
|
388 |
| -if ((s)->tabentry != NULL)\ |
389 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++;\ |
390 |
| -else {\ |
391 |
| -if (!(s)->no_stats) {\ |
392 |
| -pgstat_initstats((s), (r));\ |
393 |
| -if ((s)->tabentry != NULL)\ |
394 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ |
| 406 | +do {\ |
| 407 | +if ((s)->tabentry != NULL)\ |
| 408 | +((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++;\ |
| 409 | +else {\ |
| 410 | +if (!(s)->no_stats) {\ |
| 411 | +pgstat_initstats((s), (r));\ |
| 412 | +if ((s)->tabentry != NULL)\ |
| 413 | +((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ |
| 414 | +}\ |
395 | 415 | }\
|
396 |
| -} |
| 416 | +} while (0) |
397 | 417 | #definepgstat_count_buffer_hit(s,r)\
|
398 |
| -if ((s)->tabentry != NULL)\ |
399 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++;\ |
400 |
| -else {\ |
401 |
| -if (!(s)->no_stats) {\ |
402 |
| -pgstat_initstats((s), (r));\ |
403 |
| -if ((s)->tabentry != NULL)\ |
404 |
| -((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++;\ |
| 418 | +do {\ |
| 419 | +if ((s)->tabentry != NULL)\ |
| 420 | +((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++;\ |
| 421 | +else {\ |
| 422 | +if (!(s)->no_stats) {\ |
| 423 | +pgstat_initstats((s), (r));\ |
| 424 | +if ((s)->tabentry != NULL)\ |
| 425 | +((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \ |
| 426 | +}\ |
405 | 427 | }\
|
406 |
| -} |
| 428 | +} while (0) |
407 | 429 |
|
408 | 430 |
|
409 | 431 | externvoidpgstat_count_xact_commit(void);
|
|