Allocate new instrumentation structure(s) */
| 52 | |
| 53 | /* Allocate new instrumentation structure(s) */ |
| 54 | Instrumentation * |
| 55 | InstrAlloc(int n, int instrument_options, bool async_mode) |
| 56 | { |
| 57 | Instrumentation *instr; |
| 58 | |
| 59 | /* initialize all fields to zeroes, then modify as needed */ |
| 60 | instr = palloc0(n * sizeof(Instrumentation)); |
| 61 | if (instrument_options & (INSTRUMENT_BUFFERS | INSTRUMENT_TIMER | INSTRUMENT_WAL | INSTRUMENT_CDB)) |
| 62 | { |
| 63 | bool need_buffers = (instrument_options & INSTRUMENT_BUFFERS) != 0; |
| 64 | bool need_wal = (instrument_options & INSTRUMENT_WAL) != 0; |
| 65 | bool need_timer = (instrument_options & INSTRUMENT_TIMER) != 0; |
| 66 | bool need_cdb = (instrument_options & INSTRUMENT_CDB) != 0; |
| 67 | int i; |
| 68 | |
| 69 | for (i = 0; i < n; i++) |
| 70 | { |
| 71 | instr[i].need_bufusage = need_buffers; |
| 72 | instr[i].need_walusage = need_wal; |
| 73 | instr[i].need_timer = need_timer; |
| 74 | instr[i].need_cdb = need_cdb; |
| 75 | instr[i].async_mode = async_mode; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | return instr; |
| 80 | } |
| 81 | |
| 82 | /* Initialize a pre-allocated instrumentation structure. */ |
| 83 | void |
no test coverage detected