@@ -2720,19 +2720,38 @@ TString AddExecStatsToTxPlan(const TString& txPlanJson, const NYql::NDqProto::TD
2720
2720
}
2721
2721
2722
2722
TString SerializeAnalyzePlan (const NKqpProto::TKqpStatsQuery& queryStats) {
2723
- NJsonWriter::TBuf writer;
2724
- writer.BeginObject ();
2725
- writer.WriteKey (" TotalDurationUs" ).WriteLongLong (queryStats.GetDurationUs ());
2726
- writer.WriteKey (" QueuedTimeUs" ).WriteLongLong (queryStats.GetQueuedTimeUs ());
2727
- writer.WriteKey (" ProcessCpuTimeUs" ).WriteLongLong (queryStats.GetWorkerCpuTimeUs ());
2728
- writer.EndObject ();
2729
-
2723
+ ui64 totalCpuTimeUs = 0 ;
2730
2724
TVector<const TString> txPlans;
2731
2725
for (const auto & execStats: queryStats.GetExecutions ()) {
2726
+ totalCpuTimeUs += execStats.GetCpuTimeUs ();
2732
2727
for (const auto & txPlan: execStats.GetTxPlansWithStats ()) {
2733
2728
txPlans.push_back (txPlan);
2734
2729
}
2735
2730
}
2731
+ totalCpuTimeUs += queryStats.GetWorkerCpuTimeUs ();
2732
+
2733
+ NJsonWriter::TBuf writer;
2734
+ writer.BeginObject ();
2735
+
2736
+ if (queryStats.HasCompilation ()) {
2737
+ const auto & compilation = queryStats.GetCompilation ();
2738
+
2739
+ writer.WriteKey (" Compilation" );
2740
+ writer.BeginObject ();
2741
+ writer.WriteKey (" FromCache" ).WriteBool (compilation.GetFromCache ());
2742
+ writer.WriteKey (" DurationUs" ).WriteLongLong (compilation.GetDurationUs ());
2743
+ writer.WriteKey (" CpuTimeUs" ).WriteLongLong (compilation.GetCpuTimeUs ());
2744
+ writer.EndObject ();
2745
+
2746
+ totalCpuTimeUs += compilation.GetCpuTimeUs ();
2747
+ }
2748
+
2749
+ writer.WriteKey (" ProcessCpuTimeUs" ).WriteLongLong (queryStats.GetWorkerCpuTimeUs ());
2750
+ writer.WriteKey (" TotalCpuTimeUs" ).WriteLongLong (totalCpuTimeUs);
2751
+ writer.WriteKey (" TotalDurationUs" ).WriteLongLong (queryStats.GetDurationUs ());
2752
+ writer.WriteKey (" QueuedTimeUs" ).WriteLongLong (queryStats.GetQueuedTimeUs ());
2753
+ writer.EndObject ();
2754
+
2736
2755
return SerializeTxPlans (txPlans, TIntrusivePtr<NOpt::TKqpOptimizeContext>(), " " , writer.Str ());
2737
2756
}
2738
2757
0 commit comments