hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
hperf.cpp File Reference
#include "runtime/threading/threading.h"
#include <cstdio>
#include <cstring>
#include <runtime/hperf/hperf.h>
Include dependency graph for hperf.cpp:

Go to the source code of this file.

Functions

HPerfContexthperf_context_create (size_t unique_id)
 
void hperf_context_finalize (HPerfContext *ctx)
 
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)
 
HPerfContexthperf_context_get (size_t unique_id)
 
void hperf_init (const char *filename)
 

Variables

HPerfContexthperf_contexts = nullptr
 
bool hperf_enabled = false
 
char hperf_report_filename [2048]
 

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 = nullptr

◆ hperf_enabled

bool hperf_enabled = false

Definition at line 12 of file hperf.cpp.

Referenced by hperf_init(), and thread_starter_wrapper().

◆ hperf_report_filename

char hperf_report_filename[2048]

Definition at line 14 of file hperf.cpp.

Referenced by elysia_main(), and hperf_init().