Skip to content

Commit

Permalink
Fix: Initialize calls to zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Mar 19, 2024
1 parent c691052 commit 749e4aa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libsee.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,11 +1148,12 @@ typedef struct libsee_name_stats {

void libsee_initialize(void) {

// Initialize all the counters to zeros, without using `memset`
size_t *counters = libsee_thread_cycles[0].indexed;
// Initialize all the cycles to zeros, without using `memset`
size_t *cycles = libsee_thread_cycles[0].indexed;
size_t *calls = libsee_thread_calls[0].indexed;
size_t total_counters_per_thread = sizeof(thread_local_counters) / sizeof(size_t);
size_t total_counters_across_threads = LIBSEE_MAX_THREADS * total_counters_per_thread;
for (size_t i = 0; i < total_counters_across_threads; i++) { counters[i] = 0; }
for (size_t i = 0; i < total_counters_across_threads; i++) cycles[i] = calls[i] = 0;

// Load the symbols from the underlying implementation
real_apis *apis = &libsee_apis;
Expand Down

0 comments on commit 749e4aa

Please sign in to comment.