Skip to content

Commit ef2b3c1

Browse files
authored
Signpost for TableTreeHelpers (#13918)
1 parent 9dee03c commit ef2b3c1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Framework/Core/src/TableTreeHelpers.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Framework/TableTreeHelpers.h"
1212
#include "Framework/Logger.h"
1313
#include "Framework/Endian.h"
14+
#include "Framework/Signpost.h"
1415

1516
#include "arrow/type_traits.h"
1617
#include <arrow/dataset/file_base.h>
@@ -21,6 +22,9 @@
2122

2223
#include <memory>
2324
#include <utility>
25+
26+
O2_DECLARE_DYNAMIC_LOG(tabletree_helpers);
27+
2428
namespace TableTreeHelpers
2529
{
2630
static constexpr char const* sizeBranchSuffix = "_size";
@@ -134,6 +138,7 @@ BranchToColumn::BranchToColumn(TBranch* branch, bool VLA, std::string name, EDat
134138

135139
std::pair<std::shared_ptr<arrow::ChunkedArray>, std::shared_ptr<arrow::Field>> BranchToColumn::read(TBuffer* buffer)
136140
{
141+
O2_SIGNPOST_ID_FROM_POINTER(sid, tabletree_helpers, buffer);
137142
auto totalEntries = mBranch->GetEntries();
138143
arrow::Status status;
139144
int readEntries = 0;
@@ -170,7 +175,9 @@ std::pair<std::shared_ptr<arrow::ChunkedArray>, std::shared_ptr<arrow::Field>> B
170175
}
171176
} else {
172177
// other types: use serialized read to build arrays directly
178+
size_t branchSize = mBranch->GetTotBytes();
173179
auto&& result = arrow::AllocateResizableBuffer(mBranch->GetTotBytes(), mPool);
180+
O2_SIGNPOST_EVENT_EMIT(tabletree_helpers, sid, "BranchToColumn", "Allocating %ld bytes for %{public}s", branchSize, mBranch->GetName());
174181
if (!result.ok()) {
175182
throw runtime_error("Cannot allocate values buffer");
176183
}
@@ -526,17 +533,20 @@ void TreeToTable::setLabel(const char* label)
526533
mTableLabel = label;
527534
}
528535

529-
void TreeToTable::fill(TTree*)
536+
void TreeToTable::fill(TTree*tree)
530537
{
531538
std::vector<std::shared_ptr<arrow::ChunkedArray>> columns;
532539
std::vector<std::shared_ptr<arrow::Field>> fields;
533540
static TBufferFile buffer{TBuffer::EMode::kWrite, 4 * 1024 * 1024};
541+
O2_SIGNPOST_ID_FROM_POINTER(sid, tabletree_helpers, &buffer);
542+
O2_SIGNPOST_START(tabletree_helpers, sid, "TreeToTable", "Filling %{public}s", tree->GetName());
534543
for (auto& reader : mBranchReaders) {
535544
buffer.Reset();
536545
auto arrayAndField = reader->read(&buffer);
537546
columns.push_back(arrayAndField.first);
538547
fields.push_back(arrayAndField.second);
539548
}
549+
O2_SIGNPOST_END(tabletree_helpers, sid, "TreeToTable", "Done filling.");
540550

541551
auto schema = std::make_shared<arrow::Schema>(fields, std::make_shared<arrow::KeyValueMetadata>(std::vector{std::string{"label"}}, std::vector{mTableLabel}));
542552
mTable = arrow::Table::Make(schema, columns);

0 commit comments

Comments
 (0)