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

Function cx_run

tests/test_complexity.c:708–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706}
707
708static int cx_run(const char *root, const char *db_path, CxMetrics *out, bool pyext, bool pyrange) {
709 memset(out, 0, sizeof(*out));
710
711 uint64_t d0;
712 uint64_t b0;
713 uint64_t f0;
714 uint64_t x0;
715 cbm_pxc_filter_stats(&d0, &b0, &f0, &x0);
716 uint64_t tl0 = atomic_load_explicit(&g_lsp_tail_lookups, memory_order_relaxed);
717 uint64_t tc0 = atomic_load_explicit(&g_lsp_tail_candidates, memory_order_relaxed);
718 uint64_t fb0 = cbm_pp_lsp_linear_fallback_rows();
719 uint64_t in0 = atomic_load_explicit(&g_importance_nodes, memory_order_relaxed);
720 uint64_t iv0 = atomic_load_explicit(&g_importance_name_visits, memory_order_relaxed);
721 uint64_t kc0 = atomic_load_explicit(&g_k8s_candidates, memory_order_relaxed);
722 uint64_t oc0 = atomic_load_explicit(&g_op_candidates, memory_order_relaxed);
723 uint64_t sc0 = atomic_load_explicit(&g_sh_candidates, memory_order_relaxed);
724 uint64_t fc0 = atomic_load_explicit(&g_tf_candidates, memory_order_relaxed);
725 uint64_t dh0 = atomic_load_explicit(&g_dk_hub_edges, memory_order_relaxed);
726 uint64_t pp0 = atomic_load_explicit(&cbm_py_submodule_probes, memory_order_relaxed);
727 uint64_t pv0 = atomic_load_explicit(&cbm_py_submodule_probe_visits, memory_order_relaxed);
728 uint64_t pc0 = atomic_load_explicit(&cbm_py_module_class_binds, memory_order_relaxed);
729 uint64_t pcv0 = atomic_load_explicit(&cbm_py_module_class_bind_visits, memory_order_relaxed);
730 uint64_t pw0 = atomic_load_explicit(&cbm_py_wildcard_invalidations, memory_order_relaxed);
731 uint64_t pwv0 =
732 atomic_load_explicit(&cbm_py_wildcard_invalidation_visits, memory_order_relaxed);
733
734 atomic_store_explicit(&g_cx_pass_count, 0, memory_order_relaxed);
735 cbm_log_set_sink_ex(cx_pass_sink, CBM_LOG_SINK_TEE);
736
737 double t0 = cx_now_s();
738 cbm_pipeline_t *p = cbm_pipeline_new(root, db_path, CBM_MODE_FULL);
739 if (!p) {
740 return -1;
741 }
742 int rc = cbm_pipeline_run(p);
743 out->wall_s = cx_now_s() - t0;
744 cbm_pipeline_get_file_errors(p, NULL, &out->errors);
745 cbm_log_set_sink(NULL);
746 int captured = atomic_load_explicit(&g_cx_pass_count, memory_order_relaxed);
747 out->pass_count = captured < CX_MAX_PASSES ? captured : CX_MAX_PASSES;
748 memcpy(out->passes, g_cx_passes, (size_t)out->pass_count * sizeof(CxPassMs));
749
750 char project[512];
751 snprintf(project, sizeof(project), "%s", cbm_pipeline_project_name(p));
752 cbm_pipeline_free(p);
753 if (rc != 0) {
754 return rc;
755 }
756
757 uint64_t d1;
758 uint64_t b1;
759 uint64_t f1;
760 uint64_t x1;
761 cbm_pxc_filter_stats(&d1, &b1, &f1, &x1);
762 out->perfile_defs = d1 - d0;
763 out->build_files = b1 - b0;
764 out->filter_failed = x1 - x0;
765 out->tail_lookups = atomic_load_explicit(&g_lsp_tail_lookups, memory_order_relaxed) - tl0;

Callers 1

cx_measureFunction · 0.85

Calls 15

cbm_pxc_filter_statsFunction · 0.85
cbm_log_set_sink_exFunction · 0.85
cx_now_sFunction · 0.85
cbm_pipeline_newFunction · 0.85
cbm_pipeline_runFunction · 0.85
cbm_log_set_sinkFunction · 0.85
cbm_pipeline_freeFunction · 0.85
cbm_store_open_pathFunction · 0.85
cbm_store_count_nodesFunction · 0.85

Tested by

no test coverage detected