add tkey_list section

This commit is contained in:
silverweed 2024-07-23 10:41:55 +02:00
parent fe77a32306
commit 3dd6dd85a4
7 changed files with 24 additions and 2 deletions

View file

@ -21,7 +21,7 @@ else
MOLD = mold -run MOLD = mold -run
endif endif
ROOT_IFACE = build/RMicroFileReader.o ROOT_IFACE = build/RMicroFileReader.o
ROOT_IFACE_DBG = $(ROOT_IFACE) ROOT_IFACE_DBG = $(ROOT_IFACE).dbg
.PHONY: all clean .PHONY: all clean
all: build/imgui.o $(ROOT_IFACE) ubsan all: build/imgui.o $(ROOT_IFACE) ubsan
@ -36,6 +36,9 @@ build/imgui.o: src/imgui_inc.cpp
$(ROOT_IFACE): src/root/RMicroFileReader.cxx $(ROOT_IFACE): src/root/RMicroFileReader.cxx
$(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@ $(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@
$(ROOT_IFACE_DBG): src/root/RMicroFileReader.cxx
$(CXX) -O0 -DDEBUG -g -fPIC -c $(ROOTFLAGS) $< -o $@
# debug build # debug build
d: $(ROOT_IFACE_DBG) build/imgui.o d: $(ROOT_IFACE_DBG) build/imgui.o
$(MOLD) $(CXX) -DDEBUG -g -O0 -DENABLE_ASAN $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o -lasan $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS) $(MOLD) $(CXX) -DDEBUG -g -O0 -DENABLE_ASAN $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o -lasan $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)

View file

@ -84,6 +84,8 @@ u32 mem_edit_bg_color_fn(const u8 *, u64 off, void *user_data)
if (rdata.rng_footer.start <= off && off < rdata.rng_footer.end() - 8) return COL(app->viewer.col_footer); if (rdata.rng_footer.start <= off && off < rdata.rng_footer.end() - 8) return COL(app->viewer.col_footer);
if (rdata.rng_footer.end() - 8 <= off && off < rdata.rng_footer.end()) return COL(app->viewer.col_checksum); if (rdata.rng_footer.end() - 8 <= off && off < rdata.rng_footer.end()) return COL(app->viewer.col_checksum);
if (rdata.rng_tkeys_list.start <= off && off < rdata.rng_tkeys_list.end()) return COL(app->viewer.col_tkeys_list);
// @Speed // @Speed
for (u64 cg_idx = 0; cg_idx < rdata.n_cluster_groups; ++cg_idx) { for (u64 cg_idx = 0; cg_idx < rdata.n_cluster_groups; ++cg_idx) {
Cluster_Group_Info &cg_info = rdata.cluster_groups[cg_idx]; Cluster_Group_Info &cg_info = rdata.cluster_groups[cg_idx];
@ -155,6 +157,7 @@ void make_viewer(App_State &app)
COL(col_page_start, 200, 0, 200); COL(col_page_start, 200, 0, 200);
COL(col_checksum, 134, 65, 25); COL(col_checksum, 134, 65, 25);
COL(col_page_list, 60, 110, 120); COL(col_page_list, 60, 110, 120);
COL(col_tkeys_list, 100, 140, 100);
COL(col_highlight, 190, 190, 190); COL(col_highlight, 190, 190, 190);
#undef COL #undef COL
@ -352,6 +355,11 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", to_pretty_size(scratch.arena, app.rndata.tot_page_list_size).c()); ImGui::Text("%s", to_pretty_size(scratch.arena, app.rndata.tot_page_list_size).c());
ImGui::ColorEdit3("_TKey List", app.viewer.col_tkeys_list, flags);
ImGui::SameLine();
if (ImGui::Button("TKey List")) viewer_jump_to(app.viewer, app.rndata.rng_tkeys_list.start);
// -------------------------------
ImGui::Separator(); ImGui::Separator();
String8 root_version_str = push_str8f(scratch.arena, "%u.%u.%u", String8 root_version_str = push_str8f(scratch.arena, "%u.%u.%u",
app.tfile_data.root_version_major, app.tfile_data.root_version_major,

View file

@ -13,6 +13,7 @@ struct Viewer {
f32 col_page_start[3]; f32 col_page_start[3];
f32 col_checksum[3]; f32 col_checksum[3];
f32 col_page_list[3]; f32 col_page_list[3];
f32 col_tkeys_list[3];
f32 col_highlight[3]; f32 col_highlight[3];
u64 base_display_addr; u64 base_display_addr;

View file

@ -263,7 +263,7 @@ TFile_Data get_tfile_data(const Inspected_File &file)
memcpy(&info_nbytes_be, file.mem + root_file_info.info_nbytes_seek, sizeof(info_nbytes_be)); memcpy(&info_nbytes_be, file.mem + root_file_info.info_nbytes_seek, sizeof(info_nbytes_be));
tfile_data.rng_root_file_info.len = bswap_32(info_nbytes_be); tfile_data.rng_root_file_info.len = bswap_32(info_nbytes_be);
// parse free // parse free list
if (is_big_file) { if (is_big_file) {
u64 free_seek_be; u64 free_seek_be;
memcpy(&free_seek_be, file.mem + root_file_info.free_seek_seek, sizeof(free_seek_be)); memcpy(&free_seek_be, file.mem + root_file_info.free_seek_seek, sizeof(free_seek_be));
@ -302,6 +302,8 @@ RNTuple_Data get_rntuple_data(Arena *arena, const Inspected_File &file, String8
rndata.rng_anchor_key.start = file_info.anchor_key_seek; rndata.rng_anchor_key.start = file_info.anchor_key_seek;
rndata.rng_anchor_key.len = file_info.anchor_key_nbytes; rndata.rng_anchor_key.len = file_info.anchor_key_nbytes;
rndata.rblob_header_size = file_info.rblob_key_header_nbytes; rndata.rblob_header_size = file_info.rblob_key_header_nbytes;
rndata.rng_tkeys_list.start = file_info.tkeys_list_seek;
rndata.rng_tkeys_list.len = file_info.tkeys_list_nbytes;
gather_ntuple_metadata(arena, file_reader, file_info, rndata); gather_ntuple_metadata(arena, file_reader, file_info, rndata);
} }

View file

@ -61,6 +61,7 @@ struct RNTuple_Data {
Byte_Range rng_anchor_key; Byte_Range rng_anchor_key;
Byte_Range rng_header; Byte_Range rng_header;
Byte_Range rng_footer; Byte_Range rng_footer;
Byte_Range rng_tkeys_list;
Page_Info_Node *pages; Page_Info_Node *pages;
u64 n_pages; u64 n_pages;

View file

@ -1151,6 +1151,10 @@ RMicroFileReader::GetNTupleProper(const char *ntupleName)
offset = file.GetSeekKeys(); offset = file.GetSeekKeys();
ReadBuffer(&key, sizeof(key), offset); ReadBuffer(&key, sizeof(key), offset);
offset += key.fKeyLen; offset += key.fKeyLen;
// @-------- begin
fileInfo.tkeys_list_seek = file.GetSeekKeys();
fileInfo.tkeys_list_nbytes = key.fKeyLen + sizeof(nKeys);
// @-------- end
ReadBuffer(&nKeys, sizeof(nKeys), offset); ReadBuffer(&nKeys, sizeof(nKeys), offset);
offset += sizeof(nKeys); offset += sizeof(nKeys);
bool found = false; bool found = false;
@ -1161,6 +1165,7 @@ RMicroFileReader::GetNTupleProper(const char *ntupleName)
offset += key.GetHeaderSize(); offset += key.GetHeaderSize();
ReadBuffer(&name, 1, offset); ReadBuffer(&name, 1, offset);
ReadBuffer(&name, name.GetSize(), offset); ReadBuffer(&name, name.GetSize(), offset);
fileInfo.tkeys_list_nbytes += key.fKeyLen + 1 + name.GetSize();
if (std::string_view(name.fData, name.fLName) != kNTupleClassName) { if (std::string_view(name.fData, name.fLName) != kNTupleClassName) {
offset = offsetNextKey; offset = offsetNextKey;
continue; continue;

View file

@ -38,6 +38,8 @@ struct RNTuple_File_Info {
std::uint64_t anchor_key_seek; std::uint64_t anchor_key_seek;
std::uint64_t anchor_key_nbytes; std::uint64_t anchor_key_nbytes;
std::uint64_t rblob_key_header_nbytes; std::uint64_t rblob_key_header_nbytes;
std::uint64_t tkeys_list_seek;
std::uint64_t tkeys_list_nbytes;
}; };
struct Root_File_Info { struct Root_File_Info {