• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llnl / dftracer-utils / 28693295402

04 Jul 2026 03:17AM UTC coverage: 52.408% (+0.1%) from 52.278%
28693295402

push

github

hariharan-devarajan
feat: silence noisy warnings on aarch64

37318 of 92666 branches covered (40.27%)

Branch coverage included in aggregate %.

33462 of 42389 relevant lines covered (78.94%)

20557.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.37
/src/dftracer/utils/python/dftracer_utils_ext.cpp
1
#define PY_SSIZE_T_CLEAN
2
#include <Python.h>
3
#include <dftracer/utils/core/common/config.h>
4
#include <dftracer/utils/core/common/logging.h>
5
#include <dftracer/utils/python/batch_indexer.h>
6
#include <dftracer/utils/python/index_database.h>
7
#include <dftracer/utils/python/indexer.h>
8
#include <dftracer/utils/python/indexer_checkpoint.h>
9
#include <dftracer/utils/python/json.h>
10
#include <dftracer/utils/python/memoryview_batch.h>
11
#include <dftracer/utils/python/py_errors.h>
12
#include <dftracer/utils/python/runtime.h>
13
#include <dftracer/utils/python/sst_distribution.h>
14
#include <dftracer/utils/python/task_handle.h>
15
#include <dftracer/utils/python/trace_reader.h>
16
#include <dftracer/utils/python/trace_reader_iterator.h>
17
#include <dftracer/utils/python/utilities/aggregator.h>
18
#include <dftracer/utils/python/utilities/comparator.h>
19
#include <dftracer/utils/python/utilities/metadata_collector.h>
20
#include <dftracer/utils/python/utilities/reconstruction_planner.h>
21
#include <dftracer/utils/python/utilities/reorganization_planner.h>
22
#include <dftracer/utils/python/utilities/statistics_aggregator.h>
23
#include <dftracer/utils/python/utilities/statistics_query.h>
24
#ifdef DFTRACER_UTILS_ENABLE_ARROW
25
#include <dftracer/utils/python/arrow_stream_capsule.h>
26
#include <dftracer/utils/python/streaming_iterator.h>
27
#endif
28
#ifdef DFTRACER_UTILS_ENABLE_ARROW_IPC
29
#include <dftracer/utils/python/arrow_parallel_reader.h>
30
#endif
31

32
namespace {
33

34
PyObject* py_set_log_level(PyObject*, PyObject* args) {
26✔
35
    const char* name = nullptr;
26✔
36
    if (!PyArg_ParseTuple(args, "s", &name)) return nullptr;
26!
37
    auto lvl = dftracer::utils::logger::level_from_name(name);
26!
38
    if (!lvl) {
26✔
39
        PyErr_Format(PyExc_ValueError, "invalid log level: '%s'", name);
2!
40
        return nullptr;
2✔
41
    }
42
    dftracer::utils::logger::set_level(*lvl);
24!
43
    Py_RETURN_NONE;
24✔
44
}
13✔
45

46
PyObject* py_get_log_level(PyObject*, PyObject*) {
14✔
47
    return PyUnicode_FromString(dftracer::utils::logger::level_name(
14✔
48
        dftracer::utils::logger::get_level()));
14✔
49
}
50

51
PyObject* py_set_log_color(PyObject*, PyObject* args) {
18✔
52
    const char* mode = nullptr;
18✔
53
    if (!PyArg_ParseTuple(args, "s", &mode)) return nullptr;
18!
54
    using dftracer::utils::logger::ColorMode;
55
    const std::string_view m(mode);
18✔
56
    ColorMode cm;
57
    if (m == "auto") {
18✔
58
        cm = ColorMode::Auto;
12✔
59
    } else if (m == "always") {
12✔
60
        cm = ColorMode::Always;
2✔
61
    } else if (m == "never") {
5✔
62
        cm = ColorMode::Never;
2✔
63
    } else {
1✔
64
        PyErr_Format(PyExc_ValueError,
3!
65
                     "invalid color mode: '%s' (auto|always|never)", mode);
1✔
66
        return nullptr;
2✔
67
    }
68
    dftracer::utils::logger::set_color(cm);
16!
69
    Py_RETURN_NONE;
16✔
70
}
9✔
71

72
PyMethodDef dftracer_utils_methods[] = {
73
    {"set_log_level", py_set_log_level, METH_VARARGS,
74
     "set_log_level(level: str) -> None\n\n"
75
     "Set the C++ logger level (trace|debug|info|warn|error|off)."},
76
    {"get_log_level", py_get_log_level, METH_NOARGS,
77
     "get_log_level() -> str\n\nReturn the current C++ logger level."},
78
    {"set_log_color", py_set_log_color, METH_VARARGS,
79
     "set_log_color(mode: str) -> None\n\n"
80
     "Set the logger color mode (auto|always|never)."},
81
    {NULL, NULL, 0, NULL},
82
};
83

84
}  // namespace
85

86
static PyModuleDef dftracer_utils_module = {
87
    PyModuleDef_HEAD_INIT,
88
    "dftracer_utils_ext",   /* m_name */
89
    "DFTracer utils module with indexer, reader, "
90
    "and utility bindings", /* m_doc */
91
    -1,                     /* m_size */
92
    dftracer_utils_methods, /* m_methods */
93
    NULL,                   /* m_slots */
94
    NULL,                   /* m_traverse */
95
    NULL,                   /* m_clear */
96
    NULL                    /* m_free */
97
};
98

99
PyMODINIT_FUNC PyInit_dftracer_utils_ext(void) {
2✔
100
    PyObject* m;
101
    m = PyModule_Create(&dftracer_utils_module);
2✔
102
    if (m == NULL) return NULL;
2✔
103
    // Configure the C++ logger for the extension: picks up
104
    // DFTRACER_UTILS_LOG_LEVEL and auto color (on only when stderr is a TTY),
105
    // matching the CLI binaries. Without this the logger runs on bare defaults.
106
    dftracer::utils::logger::init();
2✔
107
    if (init_py_errors(m) < 0) return NULL;
2✔
108
    if (init_indexer_checkpoint(m) < 0) return NULL;
2✔
109
    if (init_checkpoint_indexer(m) < 0) return NULL;
2✔
110
    if (init_indexer(m) < 0) return NULL;
2✔
111
    if (init_task_handle(m) < 0) return NULL;
2✔
112
    if (init_runtime(m) < 0) return NULL;
2✔
113
    if (dftracer::utils::python::init_memoryview_batch(m) < 0) return NULL;
2✔
114
    if (init_json_dict_value(m) < 0) return NULL;
2✔
115
    if (init_trace_reader_iterator(m) < 0) return NULL;
2✔
116
#ifdef DFTRACER_UTILS_ENABLE_ARROW
117
    if (dftracer::utils::python::init_arrow_streaming_iterator(m) < 0)
2✔
118
        return NULL;
×
119
    if (init_arrow_batch_stream(m) < 0) return NULL;
2✔
120
#endif
121
#ifdef DFTRACER_UTILS_ENABLE_ARROW_IPC
122
    if (dftracer::utils::python::init_arrow_parallel_reader(m) < 0) return NULL;
2✔
123
#endif
124
    if (init_trace_reader(m) < 0) return NULL;
2✔
125
    if (init_statistics_query(m) < 0) return NULL;
2✔
126
    if (init_statistics_aggregator(m) < 0) return NULL;
2✔
127
    if (init_metadata_collector(m) < 0) return NULL;
2✔
128
    if (init_reorganization_planner(m) < 0) return NULL;
2✔
129
    if (init_reconstruction_planner(m) < 0) return NULL;
2✔
130
    if (init_aggregator(m) < 0) return NULL;
2✔
131
    if (init_comparator(m) < 0) return NULL;
2✔
132
    if (init_index_database(m) < 0) return NULL;
2✔
133
    if (init_sst_distribution(m) < 0) return NULL;
2✔
134
    return m;
2✔
135
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc