kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

profile.h (1047B)


      1 #ifndef KIT_INTERNAL_PROFILE_H
      2 #define KIT_INTERNAL_PROFILE_H
      3 
      4 #include "core/core.h"
      5 
      6 static inline KitProfiler* profile_sink(Compiler* c) {
      7   return (c && c->ctx) ? c->ctx->profiler : NULL;
      8 }
      9 
     10 static inline void profile_scope_begin(Compiler* c, KitProfileScope scope) {
     11   kit_profiler_scope_begin(profile_sink(c), scope);
     12 }
     13 
     14 static inline void profile_scope_end(Compiler* c, KitProfileScope scope) {
     15   kit_profiler_scope_end(profile_sink(c), scope);
     16 }
     17 
     18 static inline void profile_count(Compiler* c, KitProfileCounter counter,
     19                                  u64 value) {
     20   kit_profiler_count(profile_sink(c), counter, value);
     21 }
     22 
     23 static inline void profile_define_scope(Compiler* c, KitProfileScope scope,
     24                                         const char* name) {
     25   kit_profiler_define_scope(profile_sink(c), scope, name);
     26 }
     27 
     28 static inline void profile_define_counter(Compiler* c, KitProfileCounter counter,
     29                                           const char* name) {
     30   kit_profiler_define_counter(profile_sink(c), counter, name);
     31 }
     32 
     33 #endif