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

Function cbm_work_rows

src/foundation/mem_events.c:1782–1808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1780}
1781
1782size_t cbm_work_rows(cbm_work_row_t *out, size_t max) {
1783 if (!out || max == 0) {
1784 return 0;
1785 }
1786 cbm_memev_flush_thread();
1787 size_t n = 0;
1788 lock_take(&g_merge_lock);
1789 for (uint32_t i = 0; i < MEMEV_WORK_CAP && n < max; i++) {
1790 uintptr_t key = atomic_load_explicit(&g_work_keys[i], memory_order_relaxed);
1791 if (key == 0) {
1792 continue;
1793 }
1794 const work_counters_t *g = &g_work_counters[i];
1795 out[n++] = (cbm_work_row_t){
1796 .site = key & MEMEV_SITE_MASK,
1797 .kind = (cbm_work_kind_t)((key >> 56) - 1),
1798 .calls = g->calls,
1799 .bytes = g->bytes,
1800 .aux1 = g->aux1,
1801 .aux2 = g->aux2,
1802 .repeats = g->repeats,
1803 .peak = g->peak,
1804 };
1805 }
1806 lock_drop(&g_merge_lock);
1807 return n;
1808}
1809
1810static bool write_all(int fd, const char *buf, size_t len) {
1811 while (len > 0) {

Callers 1

work_rowFunction · 0.85

Calls 3

cbm_memev_flush_threadFunction · 0.85
lock_takeFunction · 0.85
lock_dropFunction · 0.85

Tested by 1

work_rowFunction · 0.68