mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +03:00
Collect JIT instrumentation from workers.
Previously, when using parallel query, EXPLAIN (ANALYZE)'s JIT compilation timings did not include the overhead from doing so on the workers. Fix that. We do so by simply aggregating the cost of doing JIT compilation on workers and the leader together. Arguably that's not quite accurate, because the total time spend doing so is spent in parallel - but it's hard to do much better. For additional detail, when VERBOSE is specified, the stats for workers are displayed separately. Author: Amit Khandekar and Andres Freund Discussion: https://postgr.es/m/CAJ3gD9eLrz51RK_gTkod+71iDcjpB_N8eC6vU2AW-VicsAERpQ@mail.gmail.com Backpatch: 11-
This commit is contained in:
@@ -24,13 +24,8 @@
|
||||
#define PGJIT_DEFORM (1 << 4)
|
||||
|
||||
|
||||
typedef struct JitContext
|
||||
typedef struct JitInstrumentation
|
||||
{
|
||||
/* see PGJIT_* above */
|
||||
int flags;
|
||||
|
||||
ResourceOwner resowner;
|
||||
|
||||
/* number of emitted functions */
|
||||
size_t created_functions;
|
||||
|
||||
@@ -45,6 +40,25 @@ typedef struct JitContext
|
||||
|
||||
/* accumulated time for code emission */
|
||||
instr_time emission_counter;
|
||||
} JitInstrumentation;
|
||||
|
||||
/*
|
||||
* DSM structure for accumulating jit instrumentation of all workers.
|
||||
*/
|
||||
typedef struct SharedJitInstrumentation
|
||||
{
|
||||
int num_workers;
|
||||
JitInstrumentation jit_instr[FLEXIBLE_ARRAY_MEMBER];
|
||||
} SharedJitInstrumentation;
|
||||
|
||||
typedef struct JitContext
|
||||
{
|
||||
/* see PGJIT_* above */
|
||||
int flags;
|
||||
|
||||
ResourceOwner resowner;
|
||||
|
||||
JitInstrumentation instr;
|
||||
} JitContext;
|
||||
|
||||
typedef struct JitProviderCallbacks JitProviderCallbacks;
|
||||
@@ -85,6 +99,7 @@ extern void jit_release_context(JitContext *context);
|
||||
* not be able to perform JIT (i.e. return false).
|
||||
*/
|
||||
extern bool jit_compile_expr(struct ExprState *state);
|
||||
extern void InstrJitAgg(JitInstrumentation *dst, JitInstrumentation *add);
|
||||
|
||||
|
||||
#endif /* JIT_H */
|
||||
|
Reference in New Issue
Block a user