[tbb-commits] [tor-browser] 133/311: Bug 1752861 - [profiler] Add a few new macros to add frame labels that will show up in javascript stacks r=gerald, a=dmeehan

gitolite role git at cupani.torproject.org
Tue Apr 26 15:28:53 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 2babdbb2605d92a1b0922547e93a1bc84813927d
Author: Julien Wajsberg <felash at gmail.com>
AuthorDate: Fri Mar 11 09:18:30 2022 +0000

    Bug 1752861 - [profiler] Add a few new macros to add frame labels that will show up in javascript stacks r=gerald, a=dmeehan
    
    Differential Revision: https://phabricator.services.mozilla.com/D140388
---
 tools/profiler/public/ProfilerLabels.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/profiler/public/ProfilerLabels.h b/tools/profiler/public/ProfilerLabels.h
index 76012d50a47e1..ebc968d3ad1cb 100644
--- a/tools/profiler/public/ProfilerLabels.h
+++ b/tools/profiler/public/ProfilerLabels.h
@@ -47,6 +47,12 @@ struct JSContext;
   mozilla::AutoProfilerLabel PROFILER_RAII(      \
       label, nullptr, JS::ProfilingCategoryPair::categoryPair)
 
+// Similar to AUTO_PROFILER_LABEL, but that adds the RELEVANT_FOR_JS flag.
+#define AUTO_PROFILER_LABEL_RELEVANT_FOR_JS(label, categoryPair) \
+  mozilla::AutoProfilerLabel PROFILER_RAII(                      \
+      label, nullptr, JS::ProfilingCategoryPair::categoryPair,   \
+      uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS))
+
 // Similar to AUTO_PROFILER_LABEL, but with only one argument: the category
 // pair. The label string is taken from the category pair. This is convenient
 // for labels like AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_LayerBuilding)
@@ -57,6 +63,15 @@ struct JSContext;
       uint32_t(                                             \
           js::ProfilingStackFrame::Flags::LABEL_DETERMINED_BY_CATEGORY_PAIR))
 
+// Similar to AUTO_PROFILER_LABEL_CATEGORY_PAIR but adding the RELEVANT_FOR_JS
+// flag.
+#define AUTO_PROFILER_LABEL_CATEGORY_PAIR_RELEVANT_FOR_JS(categoryPair)        \
+  mozilla::AutoProfilerLabel PROFILER_RAII(                                    \
+      "", nullptr, JS::ProfilingCategoryPair::categoryPair,                    \
+      uint32_t(                                                                \
+          js::ProfilingStackFrame::Flags::LABEL_DETERMINED_BY_CATEGORY_PAIR) | \
+          uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS))
+
 // Similar to AUTO_PROFILER_LABEL, but with an additional string. The inserted
 // RAII object stores the cStr pointer in a field; it does not copy the string.
 //
@@ -105,6 +120,17 @@ struct JSContext;
                                 JS::ProfilingCategoryPair::categoryPair);  \
   }
 
+#define AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING_RELEVANT_FOR_JS(           \
+    label, categoryPair, nsCStr)                                         \
+  mozilla::Maybe<nsAutoCString> autoCStr;                                \
+  mozilla::Maybe<mozilla::AutoProfilerLabel> raiiObjectNsCString;        \
+  if (profiler_is_active()) {                                            \
+    autoCStr.emplace(nsCStr);                                            \
+    raiiObjectNsCString.emplace(                                         \
+        label, autoCStr->get(), JS::ProfilingCategoryPair::categoryPair, \
+        uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));      \
+  }
+
 // Match the conditions for MOZ_ENABLE_BACKGROUND_HANG_MONITOR
 #if defined(NIGHTLY_BUILD) && !defined(MOZ_DEBUG) && !defined(MOZ_TSAN) && \
     !defined(MOZ_ASAN)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list