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

Function append_trajectory

src/foundation/diagnostics.c:494–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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