From 1e8072f2ac6e489ca587092a7ddb7b78988fb4fa Mon Sep 17 00:00:00 2001 From: Pierre GIRAUD Date: Thu, 10 Oct 2024 15:30:29 +0200 Subject: [PATCH] Show details for JIT In PlanStats as well as in the workers tab in PlanNodeDetail. --- src/components/JitDetails.vue | 34 ++++++++++++++++++++++++++++++++++ src/components/PlanStats.vue | 18 +++++++++++++++++- src/enums.ts | 4 ++++ src/filters.ts | 11 +++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/components/JitDetails.vue diff --git a/src/components/JitDetails.vue b/src/components/JitDetails.vue new file mode 100644 index 00000000..5ab27c5e --- /dev/null +++ b/src/components/JitDetails.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/PlanStats.vue b/src/components/PlanStats.vue index bcaac178..d49bd82d 100644 --- a/src/components/PlanStats.vue +++ b/src/components/PlanStats.vue @@ -9,6 +9,7 @@ import { duration, durationClass } from "@/filters" import { directive as vTippy } from "vue-tippy" import { NodeProp } from "../enums" import { formatNodeProp } from "@/filters" +import JitDetails from "@/components/JitDetails.vue" import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome" import { faCaretDown, faInfoCircle } from "@fortawesome/free-solid-svg-icons" @@ -18,6 +19,7 @@ const getHelpMessage = helpService.getHelpMessage const plan = inject(PlanKey) as Ref const showSettings = ref(false) const showTriggers = ref(false) +const showJitDetails = ref(false) const rootNode = computed(() => plan.value && plan.value.content.Plan) const planningTimeClass = (percent: number) => { @@ -135,7 +137,7 @@ function averageIO(node: Node) {
JIT: @@ -149,6 +151,20 @@ function averageIO(node: Node) { " v-html="duration(plan.planStats.jitTime)" > + +
+
+ +
+
diff --git a/src/enums.ts b/src/enums.ts index 3168a382..f20c382b 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -135,6 +135,7 @@ export enum NodeProp { ARRAY_INDEX_KEY = "arrayIndex", PEV_PLAN_TAG = "plan_", + JIT = "JIT", } export enum PropType { @@ -153,6 +154,7 @@ export enum PropType { rows, sortGroups, transferRate, + jit, } export const nodePropTypes: { [key: string]: PropType } = {} @@ -210,6 +212,8 @@ nodePropTypes[NodeProp.EXCLUSIVE_LOCAL_WRITTEN_BLOCKS] = PropType.blocks nodePropTypes[NodeProp.FULL_SORT_GROUPS] = PropType.sortGroups nodePropTypes[NodeProp.PRE_SORTED_GROUPS] = PropType.sortGroups +nodePropTypes[NodeProp.JIT] = PropType.jit + export class WorkerProp { // plan property keys public static WORKER_NUMBER = "Worker Number" diff --git a/src/filters.ts b/src/filters.ts index f07edf3e..f794f7fa 100644 --- a/src/filters.ts +++ b/src/filters.ts @@ -1,7 +1,9 @@ import _ from "lodash" import { createApp } from "vue" import { EstimateDirection, nodePropTypes, PropType } from "@/enums" +import type { JIT } from "@/enums" import SortGroup from "@/components/SortGroup.vue" +import JitDetails from "@/components/JitDetails.vue" import hljs from "highlight.js/lib/core" import pgsql from "highlight.js/lib/languages/pgsql" hljs.registerLanguage("pgsql", pgsql) @@ -170,6 +172,13 @@ export function transferRate(value: number): string { return formatBytes(value * 8 * 1024) + "/s" } +function jit(value: JIT): string { + const app = createApp(JitDetails, { jit: value }).mount( + document.createElement("div") + ) + return app.$el.outerHTML +} + export function formatNodeProp(key: string, value: unknown): string { if (_.has(nodePropTypes, key)) { if (nodePropTypes[key] === PropType.duration) { @@ -207,6 +216,8 @@ export function formatNodeProp(key: string, value: unknown): string { return sortGroups(value as string) } else if (nodePropTypes[key] === PropType.transferRate) { return transferRate(value as number) + } else if (nodePropTypes[key] === PropType.jit) { + return jit(value as JIT) } } return _.escape(value as unknown as string)