LCOV - code coverage report
Current view: top level - src - gc-alloc-profiler.h (source / functions) Hit Total Coverage
Test: [build process] commit ef510b1f346f4c9f9d86eaceace5ca54961a1dbc Lines: 3 4 75.0 %
Date: 2022-07-17 01:01:28 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : // This file is a part of Julia. License is MIT: https://julialang.org/license
       2                 :            : 
       3                 :            : #ifndef JL_GC_ALLOC_PROFILER_H
       4                 :            : #define JL_GC_ALLOC_PROFILER_H
       5                 :            : 
       6                 :            : #include "julia.h"
       7                 :            : #include "ios.h"
       8                 :            : 
       9                 :            : #ifdef __cplusplus
      10                 :            : extern "C" {
      11                 :            : #endif
      12                 :            : 
      13                 :            : // ---------------------------------------------------------------------
      14                 :            : // The public interface to call from Julia for allocations profiling
      15                 :            : // ---------------------------------------------------------------------
      16                 :            : 
      17                 :            : // Forward-declaration to avoid depenency in header file.
      18                 :            : struct jl_raw_alloc_t;  // Defined in gc-alloc-profiler.cpp
      19                 :            : 
      20                 :            : typedef struct {
      21                 :            :     struct jl_raw_alloc_t *allocs;
      22                 :            :     size_t num_allocs;
      23                 :            : } jl_profile_allocs_raw_results_t;
      24                 :            : 
      25                 :            : JL_DLLEXPORT void jl_start_alloc_profile(double sample_rate);
      26                 :            : JL_DLLEXPORT jl_profile_allocs_raw_results_t jl_fetch_alloc_profile(void);
      27                 :            : JL_DLLEXPORT void jl_stop_alloc_profile(void);
      28                 :            : JL_DLLEXPORT void jl_free_alloc_profile(void);
      29                 :            : 
      30                 :            : // ---------------------------------------------------------------------
      31                 :            : // Functions to call from GC when alloc profiling is enabled
      32                 :            : // ---------------------------------------------------------------------
      33                 :            : 
      34                 :            : void _maybe_record_alloc_to_profile(jl_value_t *val, size_t size, jl_datatype_t *typ) JL_NOTSAFEPOINT;
      35                 :            : 
      36                 :            : extern int g_alloc_profile_enabled;
      37                 :            : 
      38                 :            : #define jl_gc_unknown_type_tag ((jl_datatype_t*)0xdeadaa03)
      39                 :            : 
      40                 :  907499872 : static inline void maybe_record_alloc_to_profile(jl_value_t *val, size_t size, jl_datatype_t *typ) JL_NOTSAFEPOINT {
      41         [ -  + ]:  907499872 :     if (__unlikely(g_alloc_profile_enabled)) {
      42                 :          0 :         _maybe_record_alloc_to_profile(val, size, typ);
      43                 :            :     }
      44                 :  907499872 : }
      45                 :            : 
      46                 :            : #ifdef __cplusplus
      47                 :            : }
      48                 :            : #endif
      49                 :            : 
      50                 :            : 
      51                 :            : #endif  // JL_GC_ALLOC_PROFILER_H

Generated by: LCOV version 1.14