changes...

This commit is contained in:
2026-08-17 04:24:40 -07:00
parent 47b9a9ae38
commit 6385442711
3 changed files with 22 additions and 20 deletions
+9 -1
View File
@@ -26,6 +26,8 @@ else ifeq ($(CC),gcc)
COMP := COMPILER_GCC COMP := COMPILER_GCC
endif endif
# printf '\x01\x00' | od -to2 | head -n 1
# -ansi -pedantic -pedantic-errors # -ansi -pedantic -pedantic-errors
CFLAGS = -Wno-long-long -Wall -Wextra \ CFLAGS = -Wno-long-long -Wall -Wextra \
-Wincompatible-pointer-types \ -Wincompatible-pointer-types \
@@ -33,7 +35,13 @@ CFLAGS = -Wno-long-long -Wall -Wextra \
-Wno-strict-prototypes -Wno-missing-field-initializers \ -Wno-strict-prototypes -Wno-missing-field-initializers \
-Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \ -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \
-Wno-unused-but-set-variable \ -Wno-unused-but-set-variable \
-fno-caret-diagnostics -fno-show-column -fno-show-column
ifeq ($(COMP),COMPILER_CLANG)
CFLAGS += -fno-caret-diagnostics
else ifeq ($(COMP),COMPILER_GCC)
CFLAGS += -fno-diagnostics-show-caret
endif
ifeq ($(OS),OS_MACOS) ifeq ($(OS),OS_MACOS)
FLAGS = -glldb FLAGS = -glldb
+13 -15
View File
@@ -59,7 +59,7 @@ static struct profiler_tree_node *profiler_tree_node(const char *name)
void profiler_begin(const char *name) void profiler_begin(const char *name)
{ {
if(!profiler_root_node) { /* create root node */ if(!profiler_root_node) { /* create root node */
profiler_root_node = profiler_tree_node("TOTAL"); profiler_root_node = profiler_tree_node("");
profiler_last_node = profiler_root_node; profiler_last_node = profiler_root_node;
} }
@@ -80,14 +80,20 @@ void profiler_begin(const char *name)
profiler_last_node = node; profiler_last_node = node;
} }
void profiler_end()
{
profiler_last_node->data.end = profiler_get_time();
profiler_last_node = profiler_last_node->parent;
}
static void profiler_do_print(struct profiler_tree_node *node, static void profiler_do_print(struct profiler_tree_node *node,
int indent_level) int indentation_level)
{ {
if(node) { if(node) {
unsigned long long difference; unsigned long long difference;
int i; int i;
for(i = 0; i < indent_level; i++) for(i = 0; i < indentation_level; i++)
fprintf(stderr, " "); fprintf(stderr, " ");
difference = node->data.end - node->data.start; difference = node->data.end - node->data.start;
@@ -97,12 +103,10 @@ static void profiler_do_print(struct profiler_tree_node *node,
difference, difference,
(double)(difference) / 1000000.0); (double)(difference) / 1000000.0);
if(node->first_child) { if(node->first_child)
profiler_do_print(node->first_child, indent_level+1); profiler_do_print(node->first_child, indentation_level+1);
} if(node->next_sibling)
if(node->next_sibling) { profiler_do_print(node->next_sibling, indentation_level);
profiler_do_print(node->next_sibling, indent_level);
}
} }
} }
@@ -111,12 +115,6 @@ void profiler_print()
profiler_do_print(profiler_root_node->first_child, 0); profiler_do_print(profiler_root_node->first_child, 0);
} }
void profiler_end()
{
profiler_last_node->data.end = profiler_get_time();
profiler_last_node = profiler_last_node->parent;
}
#else #else
#define profiler_begin(...) #define profiler_begin(...)
-4
View File
@@ -766,16 +766,12 @@ U64 __rdtsc()
} }
#endif #endif
#include "profiler.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct sdl_state sdl_state; struct sdl_state sdl_state;
SDL_Window *window; SDL_Window *window;
int i;
memset(&sdl_state, 0, sizeof(sdl_state)); memset(&sdl_state, 0, sizeof(sdl_state));
sdl_get_exe_dir_path(sdl_state.exe_dir_path, sdl_get_exe_dir_path(sdl_state.exe_dir_path,