[clang] [clang][dataflow] Display line numbers in the HTML logger timeline. (PR #80130)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 03:48:20 PST 2024


https://github.com/martinboehme created https://github.com/llvm/llvm-project/pull/80130

This makes it easier to count how many iterations an analysis takes to complete.
It also makes it easier to compare how a change to the analysis code affects
the timeline.


>From 9f49f326840a706fd3cab99843d7eb60762f3e3e Mon Sep 17 00:00:00 2001
From: Martin Braenne <mboehme at google.com>
Date: Wed, 31 Jan 2024 11:46:17 +0000
Subject: [PATCH] [clang][dataflow] Display line numbers in the HTML logger
 timeline.

This makes it easier to count how many iterations an analysis takes to complete.
It also makes it easier to compare how a change to the analysis code affects
the timeline.
---
 clang/lib/Analysis/FlowSensitive/HTMLLogger.css  | 10 ++++++++++
 clang/lib/Analysis/FlowSensitive/HTMLLogger.html |  1 +
 2 files changed, 11 insertions(+)

diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
index 5da8db8fa87bf..e25270430efc2 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
@@ -29,6 +29,16 @@ section h2 {
 }
 #timeline {
   min-width: max-content;
+  counter-reset: entry_counter;
+}
+#timeline .entry .counter::before {
+  counter-increment: entry_counter;
+  content: counter(entry_counter) ":";
+}
+#timeline .entry .counter {
+  display: inline-block;
+  min-width: 2em; /* Enough space for two digits and a colon */
+  text-align: right;
 }
 #timeline .entry.hover {
   background-color: #aaa;
diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html b/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
index b9f76c5074c75..be173e8b2854d 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
@@ -42,6 +42,7 @@
 <header>Timeline</header>
 <template data-for="entry in timeline">
   <div id="{{entry.block}}:{{entry.iter}}" data-bb="{{entry.block}}" class="entry">
+    <span class="counter"></span>
     {{entry.block}}
     <template data-if="entry.post_visit">(post-visit)</template>
     <template data-if="!entry.post_visit">({{entry.iter}})</template>



More information about the cfe-commits mailing list