|
21 | 21 | #include"commands/prepare.h"
|
22 | 22 | #include"executor/nodeHash.h"
|
23 | 23 | #include"foreign/fdwapi.h"
|
| 24 | +#include"jit/jit.h" |
24 | 25 | #include"nodes/extensible.h"
|
25 | 26 | #include"nodes/nodeFuncs.h"
|
26 | 27 | #include"optimizer/clauses.h"
|
@@ -556,6 +557,16 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
|
556 | 557 | if (es->analyze)
|
557 | 558 | ExplainPrintTriggers(es,queryDesc);
|
558 | 559 |
|
| 560 | +/* |
| 561 | + * Print info about JITing. Tied to es->costs because we don't want to |
| 562 | + * display this in regression tests, as it'd cause output differences |
| 563 | + * depending on build options. Might want to separate that out from COSTS |
| 564 | + * at a later stage. |
| 565 | + */ |
| 566 | +if (queryDesc->estate->es_jit&&es->costs&& |
| 567 | +queryDesc->estate->es_jit->created_functions>0) |
| 568 | +ExplainPrintJIT(es,queryDesc); |
| 569 | + |
559 | 570 | /*
|
560 | 571 | * Close down the query and free resources. Include time for this in the
|
561 | 572 | * total execution time (although it should be pretty minimal).
|
@@ -677,6 +688,54 @@ ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc)
|
677 | 688 | ExplainCloseGroup("Triggers","Triggers", false,es);
|
678 | 689 | }
|
679 | 690 |
|
| 691 | +/* |
| 692 | + * ExplainPrintJIT - |
| 693 | + * Append information about JITing to es->str. |
| 694 | + */ |
| 695 | +void |
| 696 | +ExplainPrintJIT(ExplainState*es,QueryDesc*queryDesc) |
| 697 | +{ |
| 698 | +JitContext*jc=queryDesc->estate->es_jit; |
| 699 | + |
| 700 | +ExplainOpenGroup("JIT","JIT", true,es); |
| 701 | + |
| 702 | +if (es->format==EXPLAIN_FORMAT_TEXT) |
| 703 | +{ |
| 704 | +es->indent+=1; |
| 705 | +appendStringInfo(es->str,"JIT:\n"); |
| 706 | +} |
| 707 | + |
| 708 | +ExplainPropertyInteger("Functions",NULL,jc->created_functions,es); |
| 709 | +if (es->analyze&&es->timing) |
| 710 | +ExplainPropertyFloat("Generation Time","ms", |
| 711 | +1000.0*INSTR_TIME_GET_DOUBLE(jc->generation_counter), |
| 712 | +3,es); |
| 713 | + |
| 714 | +ExplainPropertyBool("Inlining",jc->flags&PGJIT_INLINE,es); |
| 715 | + |
| 716 | +if (es->analyze&&es->timing) |
| 717 | +ExplainPropertyFloat("Inlining Time","ms", |
| 718 | +1000.0*INSTR_TIME_GET_DOUBLE(jc->inlining_counter), |
| 719 | +3,es); |
| 720 | + |
| 721 | +ExplainPropertyBool("Optimization",jc->flags&PGJIT_OPT3,es); |
| 722 | +if (es->analyze&&es->timing) |
| 723 | +ExplainPropertyFloat("Optimization Time","ms", |
| 724 | +1000.0*INSTR_TIME_GET_DOUBLE(jc->optimization_counter), |
| 725 | +3,es); |
| 726 | + |
| 727 | +if (es->analyze&&es->timing) |
| 728 | +ExplainPropertyFloat("Emission Time","ms", |
| 729 | +1000.0*INSTR_TIME_GET_DOUBLE(jc->emission_counter), |
| 730 | +3,es); |
| 731 | + |
| 732 | +ExplainCloseGroup("JIT","JIT", true,es); |
| 733 | +if (es->format==EXPLAIN_FORMAT_TEXT) |
| 734 | +{ |
| 735 | +es->indent-=1; |
| 736 | +} |
| 737 | +} |
| 738 | + |
680 | 739 | /*
|
681 | 740 | * ExplainQueryText -
|
682 | 741 | * add a "Query Text" node that contains the actual text of the query
|
|