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

llnl / dftracer-utils / 30067416336

24 Jul 2026 04:40AM UTC coverage: 50.693% (-2.0%) from 52.66%
30067416336

Pull #99

github

web-flow
Merge 464586f0d into 06bc84ec9
Pull Request #99: Support CM time_metric (NS/MS/SEC/US) across reader and viz

18063 of 48203 branches covered (37.47%)

Branch coverage included in aggregate %.

1514 of 2204 new or added lines in 58 files covered. (68.69%)

741 existing lines in 114 files now uncovered.

23715 of 34210 relevant lines covered (69.32%)

39842.55 hits per line

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

76.47
/src/dftracer/utils/core/rocksdb/key_codec.cpp
1
#include <dftracer/utils/core/common/error.h>
2
#include <dftracer/utils/core/rocksdb/key_codec.h>
3

4
#include <stdexcept>
5

6
namespace dftracer::utils::rocksdb {
7

8
namespace {
9

10
template <typename T>
11
T decode_big_endian(std::string_view bytes) {
384,271✔
12
    if (bytes.size() != sizeof(T)) {
384,271!
13
        throw DFTUtilsException(ErrorCode::PARSE,
×
14
                                "KeyCodec: invalid big-endian integer width");
15
    }
16

17
    T value = 0;
384,264✔
18
    for (unsigned char byte : bytes) {
3,001,479✔
19
        value = static_cast<T>((value << 8U) | byte);
2,617,215✔
20
    }
21
    return value;
384,317✔
22
}
23

24
}  // namespace
25

26
std::string KeyCodec::encode_be32(std::uint32_t value) {
18,373✔
27
    std::string out;
18,373✔
28
    out.reserve(sizeof(value));
18,343!
29
    append_be32(out, value);
18,334!
30
    return out;
18,369✔
UNCOV
31
}
×
32

33
std::string KeyCodec::encode_be64(std::uint64_t value) {
1,602✔
34
    std::string out;
1,602✔
35
    out.reserve(sizeof(value));
1,600!
36
    append_be64(out, value);
1,604!
37
    return out;
1,608✔
UNCOV
38
}
×
39

40
std::uint32_t KeyCodec::decode_be32(std::string_view bytes) {
114,202✔
41
    return decode_big_endian<std::uint32_t>(bytes);
114,202✔
42
}
43

44
std::uint64_t KeyCodec::decode_be64(std::string_view bytes) {
270,091✔
45
    return decode_big_endian<std::uint64_t>(bytes);
270,091✔
46
}
47

48
void KeyCodec::append_be32(std::string& out, std::uint32_t value) {
236,337✔
49
    for (int shift = 24; shift >= 0; shift -= 8) {
1,180,336✔
50
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
944,306✔
51
    }
52
}
236,030✔
53

54
void KeyCodec::append_be64(std::string& out, std::uint64_t value) {
238,206✔
55
    for (int shift = 56; shift >= 0; shift -= 8) {
2,139,931✔
56
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
1,901,965✔
57
    }
58
}
237,966✔
59

60
KeyBuilder& KeyBuilder::append_tag(std::string_view tag) {
1✔
61
    key_.append(tag);
1✔
62
    return *this;
1✔
63
}
64

65
KeyBuilder& KeyBuilder::append_separator() {
1✔
66
    key_.push_back('\0');
1✔
67
    return *this;
1✔
68
}
69

70
KeyBuilder& KeyBuilder::append_string(std::string_view value) {
×
71
    key_.append(value);
×
72
    return *this;
×
73
}
74

75
KeyBuilder& KeyBuilder::append_be32(std::uint32_t value) {
1✔
76
    KeyCodec::append_be32(key_, value);
1✔
77
    return *this;
1✔
78
}
79

80
KeyBuilder& KeyBuilder::append_be64(std::uint64_t value) {
1✔
81
    KeyCodec::append_be64(key_, value);
1✔
82
    return *this;
1✔
83
}
84

85
std::string KeyBuilder::build() const { return key_; }
1✔
86

87
void KeyBuilder::clear() { key_.clear(); }
×
88

89
}  // namespace dftracer::utils::rocksdb
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc