• 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

61.5
/src/dftracer/utils/python/utilities/metadata_collector.cpp
1
#define PY_SSIZE_T_CLEAN
2
#include <dftracer/utils/core/common/archive_format.h>
3
#include <dftracer/utils/core/coro/task.h>
4
#include <dftracer/utils/core/runtime.h>
5
#include <dftracer/utils/python/py_dict_helpers.h>
6
#include <dftracer/utils/python/py_runtime_mixin.h>
7
#include <dftracer/utils/python/py_type_helpers.h>
8
#include <dftracer/utils/python/runtime.h>
9
#include <dftracer/utils/python/utilities/metadata_collector.h>
10
#include <dftracer/utils/utilities/composites/dft/internal/utils.h>
11
#include <dftracer/utils/utilities/composites/dft/metadata_collector_utility.h>
12

13
#include <string>
14

15
using dftracer::utils::get_format_name;
16
using dftracer::utils::Runtime;
17
using dftracer::utils::coro::CoroTask;
18
using namespace dftracer::utils::utilities::composites::dft;
19

20
DFTRACER_UTILS_RUNTIME_BACKED_SLOTS(MetadataCollector, MetadataCollectorObject)
24✔
21

22
static PyObject *MetadataCollector_collect(MetadataCollectorObject *self,
8✔
23
                                           PyObject *args, PyObject *kwds) {
24
    static const char *kwlist[] = {"file_path", "index_dir", NULL};
25
    const char *file_path;
26
    const char *index_dir = "";
8✔
27
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|s", (char **)kwlist,
8!
28
                                     &file_path, &index_dir))
29
        return NULL;
×
30

31
    std::string file_path_str(file_path);
8!
32
    std::string index_dir_str(index_dir);
8!
33
    MetadataCollectorUtilityOutput output;
8✔
34

35
    if (!run_blocking([&] {
12!
36
            Runtime *rt = resolve_runtime(self);
8!
37

38
            MetadataCollectorUtilityInput input;
8✔
39
            input.file_path = file_path_str;
8!
40
            input.index_path = dftracer::utils::utilities::composites::dft::
4!
41
                internal::determine_index_path(file_path_str, index_dir_str);
8!
42

43
            auto *out_p = &output;
8✔
44
            auto input_copy = input;
8!
45
            auto task = [out_p, input_copy]() -> CoroTask<void> {
36!
46
                MetadataCollectorUtility util;
12!
47
                *out_p = co_await util.process(input_copy);
16!
48
            };
24!
49
            rt->submit(task(), "metadata-collector").get();
8!
50
        })) {
8✔
51
        return NULL;
×
52
    }
53

54
    PyObject *d = PyDict_New();
8!
55
    if (!d) return NULL;
8✔
56

57
    int rc = 0;
8✔
58
    rc |= dict_set_str(d, "file_path", output.file_path.c_str());
8!
59
    rc |= dict_set_str(d, "index_path", output.index_path.c_str());
8!
60
    rc |= dict_set_f64(d, "size_mb", output.size_mb);
8!
61
    rc |= dict_set_size(d, "start_line", output.start_line);
8!
62
    rc |= dict_set_size(d, "end_line", output.end_line);
8!
63
    rc |= dict_set_size(d, "valid_events", output.valid_events);
8!
64
    rc |= dict_set_f64(d, "size_per_line", output.size_per_line);
8!
65
    rc |= dict_set_bool(d, "success", output.success);
8!
66
    rc |= dict_set_bool(d, "has_index", output.has_index);
8!
67
    rc |= dict_set_bool(d, "index_valid", output.index_valid);
8!
68
    rc |= dict_set_u64(d, "compressed_size", output.compressed_size);
8!
69
    rc |= dict_set_u64(d, "uncompressed_size", output.uncompressed_size);
8!
70
    rc |= dict_set_u64(d, "num_lines", output.num_lines);
8!
71
    rc |= dict_set_u64(d, "checkpoint_size", output.checkpoint_size);
8!
72
    rc |= dict_set_size(d, "num_checkpoints", output.num_checkpoints);
8!
73
    rc |= dict_set_str(d, "format", get_format_name(output.format));
8!
74
    rc |= dict_set_str(d, "error_message", output.error_message.c_str());
8!
75

76
    if (rc != 0) {
8!
77
        Py_DECREF(d);
×
78
        return NULL;
×
79
    }
80

81
    return d;
8✔
82
}
8✔
83

84
static PyObject *MetadataCollector_call(PyObject *self, PyObject *args,
2✔
85
                                        PyObject *kwds) {
86
    return MetadataCollector_collect((MetadataCollectorObject *)self, args,
3✔
87
                                     kwds);
2✔
88
}
89

90
static PyMethodDef MetadataCollector_methods[] = {
91
    {"process", (PyCFunction)MetadataCollector_collect,
92
     METH_VARARGS | METH_KEYWORDS,
93
     "Collect metadata from a trace file.\n"
94
     "\n"
95
     "Args:\n"
96
     "    file_path (str): Path to the trace file.\n"
97
     "    index_dir (str): Directory for .dftindex stores.\n"},
98
    {NULL}};
99

100
PyTypeObject MetadataCollectorType = {
101
    PyVarObject_HEAD_INIT(
102
        NULL, 0) "dftracer_utils_ext.MetadataCollectorUtility", /* tp_name */
103
    sizeof(MetadataCollectorObject),          /* tp_basicsize */
104
    0,                                        /* tp_itemsize */
105
    (destructor)MetadataCollector_dealloc,    /* tp_dealloc */
106
    0,                                        /* tp_vectorcall_offset */
107
    0,                                        /* tp_getattr */
108
    0,                                        /* tp_setattr */
109
    0,                                        /* tp_as_async */
110
    0,                                        /* tp_repr */
111
    0,                                        /* tp_as_number */
112
    0,                                        /* tp_as_sequence */
113
    0,                                        /* tp_as_mapping */
114
    0,                                        /* tp_hash */
115
    MetadataCollector_call,                   /* tp_call */
116
    0,                                        /* tp_str */
117
    0,                                        /* tp_getattro */
118
    0,                                        /* tp_setattro */
119
    0,                                        /* tp_as_buffer */
120
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
121
    "MetadataCollectorUtility(runtime: Runtime | None = None)\n"
122
    "--\n\n"
123
    "Collect metadata from a DFTracer trace file.\n\n"
124
    "Args:\n"
125
    "    runtime (Runtime or None): Runtime for thread pool control.\n"
126
    "\n"
127
    "process(file_path, index_dir='') -> dict\n"
128
    "    file_path (str): Path to the trace file.\n"
129
    "    index_dir (str): Directory for .dftindex stores.\n",
130
    0,                                /* tp_traverse */
131
    0,                                /* tp_clear */
132
    0,                                /* tp_richcompare */
133
    0,                                /* tp_weaklistoffset */
134
    0,                                /* tp_iter */
135
    0,                                /* tp_iternext */
136
    MetadataCollector_methods,        /* tp_methods */
137
    0,                                /* tp_members */
138
    0,                                /* tp_getset */
139
    0,                                /* tp_base */
140
    0,                                /* tp_dict */
141
    0,                                /* tp_descr_get */
142
    0,                                /* tp_descr_set */
143
    0,                                /* tp_dictoffset */
144
    (initproc)MetadataCollector_init, /* tp_init */
145
    0,                                /* tp_alloc */
146
    MetadataCollector_new,            /* tp_new */
147
};
148

149
int init_metadata_collector(PyObject *m) {
2✔
150
    if (register_type(m, &MetadataCollectorType, "MetadataCollectorUtility") <
2✔
151
        0)
152
        return -1;
×
153

154
    return 0;
2✔
155
}
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