MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / append_trajectory

Function append_trajectory

src/foundation/diagnostics.c:493–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491#endif
492
493static void append_trajectory(long uptime, size_t rss, size_t peak_rss, size_t commit,
494 size_t peak_commit, size_t page_faults, int fds, int qcount) {
495 if (g_diag_ndjson_size > DIAG_NDJSON_CAP_BYTES) {
496 if (!diag_native_rename(DIAG_TRAJECTORY_NAME, DIAG_TRAJECTORY_ROTATED_NAME)) {
497 return;
498 }
499 g_diag_ndjson_size = 0;
500 }
501 char line[CBM_SZ_512];
502 int length = snprintf(line, sizeof(line),
503 "{\"uptime_s\":%ld,\"rss\":%zu,\"peak_rss\":%zu,\"committed\":%zu,"
504 "\"peak_committed\":%zu,\"page_faults\":%zu,\"fd\":%d,\"queries\":%d}\n",
505 uptime, rss, peak_rss, commit, peak_commit, page_faults, fds, qcount);
506 if (length <= 0 || (size_t)length >= sizeof(line) ||
507 !diag_write_file(DIAG_TRAJECTORY_NAME, line, (size_t)length, true)) {
508 return;
509 }
510 g_diag_ndjson_size += (size_t)length;
511}
512
513static void write_diagnostics(void) {
514#ifdef CBM_DIAGNOSTICS_ENABLE_TEST_API

Callers 1

write_diagnosticsFunction · 0.85

Calls 2

diag_native_renameFunction · 0.85
diag_write_fileFunction · 0.85

Tested by

no test coverage detected