LCOV - code coverage report
Current view: top level - gjs - profiler-private.h (source / functions) Coverage Total Hit
Test: gjs- Code Coverage Lines: 77.8 % 9 7
Test Date: 2024-03-26 02:45:07 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 50.0 % 4 2

             Branch data     Line data    Source code
       1                 :             : /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
       2                 :             : // SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
       3                 :             : // SPDX-FileCopyrightText: 2018 Endless Mobile, Inc.
       4                 :             : 
       5                 :             : #ifndef GJS_PROFILER_PRIVATE_H_
       6                 :             : #define GJS_PROFILER_PRIVATE_H_
       7                 :             : 
       8                 :             : #include <config.h>
       9                 :             : 
      10                 :             : #include <stdint.h>
      11                 :             : 
      12                 :             : #include <js/ProfilingCategory.h>
      13                 :             : #include <js/ProfilingStack.h>
      14                 :             : #include <js/RootingAPI.h>
      15                 :             : #include <js/TypeDecls.h>
      16                 :             : 
      17                 :             : #include "gjs/context.h"
      18                 :             : #include "gjs/profiler.h"
      19                 :             : 
      20                 :             : class AutoProfilerLabel {
      21                 :             :  public:
      22                 :       69355 :     explicit inline AutoProfilerLabel(JSContext* cx, const char* label,
      23                 :             :                                       const char* dynamicString,
      24                 :             :                                       JS::ProfilingCategoryPair categoryPair =
      25                 :             :                                           JS::ProfilingCategoryPair::OTHER,
      26                 :             :                                       uint32_t flags = 0)
      27                 :       69355 :         : m_stack(js::GetContextProfilingStackIfEnabled(cx)) {
      28         [ -  + ]:       69355 :         if (m_stack)
      29                 :           0 :             m_stack->pushLabelFrame(label, dynamicString, this, categoryPair,
      30                 :             :                                     flags);
      31                 :       69355 :     }
      32                 :             : 
      33                 :       69352 :     inline ~AutoProfilerLabel() {
      34         [ -  + ]:       69352 :         if (m_stack)
      35                 :           0 :             m_stack->pop();
      36                 :       69352 :     }
      37                 :             : 
      38                 :             :  private:
      39                 :             :     ProfilingStack* m_stack;
      40                 :             : };
      41                 :             : 
      42                 :             : namespace Gjs {
      43                 :             : enum GCCounters { GC_HEAP_BYTES, MALLOC_HEAP_BYTES, N_COUNTERS };
      44                 :             : }  // namespace Gjs
      45                 :             : 
      46                 :             : GjsProfiler *_gjs_profiler_new(GjsContext *context);
      47                 :             : void _gjs_profiler_free(GjsProfiler *self);
      48                 :             : 
      49                 :             : void _gjs_profiler_add_mark(GjsProfiler* self, int64_t time, int64_t duration,
      50                 :             :                             const char* group, const char* name,
      51                 :             :                             const char* message);
      52                 :             : 
      53                 :             : [[nodiscard]] bool _gjs_profiler_sample_gc_memory_info(
      54                 :             :     GjsProfiler* self, int64_t gc_counters[Gjs::GCCounters::N_COUNTERS]);
      55                 :             : 
      56                 :             : [[nodiscard]] bool _gjs_profiler_is_running(GjsProfiler* self);
      57                 :             : 
      58                 :             : void _gjs_profiler_setup_signals(GjsProfiler *self, GjsContext *context);
      59                 :             : 
      60                 :             : #endif  // GJS_PROFILER_PRIVATE_H_
        

Generated by: LCOV version 2.0-1