hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
hperf.h File Reference
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <runtime/fs/fs.h>
#include <runtime/time/time.h>
#include <runtime/threading/threading.h>
Include dependency graph for hperf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HPerfTimestamp
 
struct  HPerfEvent
 
struct  HPerfEventFuncEnter
 
struct  HPerfEventFuncLeave
 
struct  HPerfEventMemAlloc
 
struct  HPerfEventMemFree
 
struct  HPerfPage
 
struct  HPerfContext
 

Enumerations

enum class  HPerfEventType : uint8_t { HPERF_EVT_FUNC_ENTER = 0 , HPERF_EVT_FUNC_LEAVE , HPERF_EVT_MEM_ALLOC , HPERF_EVT_MEM_FREE }
 

Functions

HPerfContexthperf_context_create (size_t unique_id)
 
void hperf_context_finalize (HPerfContext *ctx)
 
HPerfContexthperf_context_get (size_t unique_id)
 
HPerfEventhperf_context_add_event (HPerfContext *ctx)
 
void hperf_report_func_enter (const char *func_name)
 
void hperf_report_func_leave (const char *func_name)
 
void hperf_report_mem_alloc (void *ptr, size_t size)
 
void hperf_report_mem_free (void *ptr)
 
void hperf_write_report (const char *filename)
 
void hperf_init (const char *filename)
 

Variables

HPerfContexthperf_contexts
 
bool hperf_enabled
 
char hperf_report_filename [2048]
 

Enumeration Type Documentation

◆ HPerfEventType

enum class HPerfEventType : uint8_t
strong
Enumerator
HPERF_EVT_FUNC_ENTER 
HPERF_EVT_FUNC_LEAVE 
HPERF_EVT_MEM_ALLOC 
HPERF_EVT_MEM_FREE 

Definition at line 15 of file hperf.h.

Function Documentation

◆ hperf_context_add_event()

HPerfEvent * hperf_context_add_event ( HPerfContext ctx)

◆ hperf_context_create()

HPerfContext * hperf_context_create ( size_t  unique_id)

Definition at line 16 of file hperf.cpp.

References HPerfContext::current_page, hperf_contexts, HPerfContext::next, HPerfContext::num_events, HPerfContext::pages, HPerfContext::prev, and HPerfContext::unique_id.

Referenced by hperf_init(), and thread_starter_wrapper().

Here is the caller graph for this function:

◆ hperf_context_finalize()

void hperf_context_finalize ( HPerfContext ctx)

◆ hperf_context_get()

HPerfContext * hperf_context_get ( size_t  unique_id)

Definition at line 191 of file hperf.cpp.

References hperf_contexts, HPerfContext::next, and HPerfContext::unique_id.

Referenced by hperf_report_func_enter(), hperf_report_func_leave(), hperf_report_mem_alloc(), and hperf_report_mem_free().

Here is the caller graph for this function:

◆ hperf_init()

void hperf_init ( const char *  filename)

Definition at line 202 of file hperf.cpp.

References hperf_context_create(), hperf_contexts, hperf_enabled, hperf_report_filename, and runtime_get_thread_id().

Referenced by elysia_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hperf_report_func_enter()

void hperf_report_func_enter ( const char *  func_name)

Definition at line 73 of file hperf.cpp.

References HPerfEventFuncEnter::func_name, hperf_context_add_event(), hperf_context_get(), HPERF_EVT_FUNC_ENTER, and runtime_get_thread_id().

Referenced by runtime_debug_report_current_function().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hperf_report_func_leave()

void hperf_report_func_leave ( const char *  func_name)

Definition at line 84 of file hperf.cpp.

References HPerfEventFuncLeave::func_name, hperf_context_add_event(), hperf_context_get(), HPERF_EVT_FUNC_LEAVE, and runtime_get_thread_id().

Referenced by runtime_debug_report_leave_function().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hperf_report_mem_alloc()

void hperf_report_mem_alloc ( void *  ptr,
size_t  size 
)

Definition at line 95 of file hperf.cpp.

References hperf_context_add_event(), hperf_context_get(), HPERF_EVT_MEM_ALLOC, HPerfEventMemAlloc::ptr, and runtime_get_thread_id().

Referenced by runtime_object_alloc_report().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hperf_report_mem_free()

void hperf_report_mem_free ( void *  ptr)

Definition at line 107 of file hperf.cpp.

References hperf_context_add_event(), hperf_context_get(), HPERF_EVT_MEM_FREE, HPerfEventMemFree::ptr, and runtime_get_thread_id().

Referenced by runtime_finalize_object_report().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hperf_write_report()

void hperf_write_report ( const char *  filename)

Definition at line 118 of file hperf.cpp.

References hperf_contexts, HPERF_EVT_FUNC_ENTER, HPERF_EVT_FUNC_LEAVE, HPERF_EVT_MEM_ALLOC, HPERF_EVT_MEM_FREE, and HPerfContext::next.

Referenced by elysia_main().

Here is the caller graph for this function:

Variable Documentation

◆ hperf_contexts

HPerfContext* hperf_contexts
extern

◆ hperf_enabled

bool hperf_enabled
extern

Definition at line 12 of file hperf.cpp.

Referenced by hperf_init(), and thread_starter_wrapper().

◆ hperf_report_filename

char hperf_report_filename[2048]
extern

Definition at line 14 of file hperf.cpp.

Referenced by elysia_main(), and hperf_init().