|
11 | 11 | #include "Framework/TableTreeHelpers.h" |
12 | 12 | #include "Framework/Logger.h" |
13 | 13 | #include "Framework/Endian.h" |
| 14 | +#include "Framework/Signpost.h" |
14 | 15 |
|
15 | 16 | #include "arrow/type_traits.h" |
16 | 17 | #include <arrow/dataset/file_base.h> |
|
21 | 22 |
|
22 | 23 | #include <memory> |
23 | 24 | #include <utility> |
| 25 | + |
| 26 | +O2_DECLARE_DYNAMIC_LOG(tabletree_helpers); |
| 27 | + |
24 | 28 | namespace TableTreeHelpers |
25 | 29 | { |
26 | 30 | static constexpr char const* sizeBranchSuffix = "_size"; |
@@ -134,6 +138,7 @@ BranchToColumn::BranchToColumn(TBranch* branch, bool VLA, std::string name, EDat |
134 | 138 |
|
135 | 139 | std::pair<std::shared_ptr<arrow::ChunkedArray>, std::shared_ptr<arrow::Field>> BranchToColumn::read(TBuffer* buffer) |
136 | 140 | { |
| 141 | + O2_SIGNPOST_ID_FROM_POINTER(sid, tabletree_helpers, buffer); |
137 | 142 | auto totalEntries = mBranch->GetEntries(); |
138 | 143 | arrow::Status status; |
139 | 144 | int readEntries = 0; |
@@ -170,7 +175,9 @@ std::pair<std::shared_ptr<arrow::ChunkedArray>, std::shared_ptr<arrow::Field>> B |
170 | 175 | } |
171 | 176 | } else { |
172 | 177 | // other types: use serialized read to build arrays directly |
| 178 | + size_t branchSize = mBranch->GetTotBytes(); |
173 | 179 | 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()); |
174 | 181 | if (!result.ok()) { |
175 | 182 | throw runtime_error("Cannot allocate values buffer"); |
176 | 183 | } |
@@ -526,17 +533,20 @@ void TreeToTable::setLabel(const char* label) |
526 | 533 | mTableLabel = label; |
527 | 534 | } |
528 | 535 |
|
529 | | -void TreeToTable::fill(TTree*) |
| 536 | +void TreeToTable::fill(TTree*tree) |
530 | 537 | { |
531 | 538 | std::vector<std::shared_ptr<arrow::ChunkedArray>> columns; |
532 | 539 | std::vector<std::shared_ptr<arrow::Field>> fields; |
533 | 540 | 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()); |
534 | 543 | for (auto& reader : mBranchReaders) { |
535 | 544 | buffer.Reset(); |
536 | 545 | auto arrayAndField = reader->read(&buffer); |
537 | 546 | columns.push_back(arrayAndField.first); |
538 | 547 | fields.push_back(arrayAndField.second); |
539 | 548 | } |
| 549 | + O2_SIGNPOST_END(tabletree_helpers, sid, "TreeToTable", "Done filling."); |
540 | 550 |
|
541 | 551 | auto schema = std::make_shared<arrow::Schema>(fields, std::make_shared<arrow::KeyValueMetadata>(std::vector{std::string{"label"}}, std::vector{mTableLabel})); |
542 | 552 | mTable = arrow::Table::Make(schema, columns); |
|
0 commit comments