diff --git a/include/caliper/reader/Aggregator.h b/include/caliper/reader/Aggregator.h index d5528027..c2f8eca6 100644 --- a/include/caliper/reader/Aggregator.h +++ b/include/caliper/reader/Aggregator.h @@ -30,8 +30,6 @@ class Aggregator Aggregator(const QuerySpec& spec); - ~Aggregator(); - void add(CaliperMetadataAccessInterface&, const EntryList&); void operator() (CaliperMetadataAccessInterface& db, const EntryList& list) { add(db, list); } diff --git a/include/caliper/reader/CaliWriter.h b/include/caliper/reader/CaliWriter.h index 4e424a90..80e0a0d8 100644 --- a/include/caliper/reader/CaliWriter.h +++ b/include/caliper/reader/CaliWriter.h @@ -26,11 +26,8 @@ class CaliWriter public: CaliWriter() {} - CaliWriter(OutputStream& os); - ~CaliWriter(); - size_t num_written() const; void write_snapshot(const CaliperMetadataAccessInterface&, const std::vector&); diff --git a/include/caliper/reader/FormatProcessor.h b/include/caliper/reader/FormatProcessor.h index 70006ce2..55e63f71 100644 --- a/include/caliper/reader/FormatProcessor.h +++ b/include/caliper/reader/FormatProcessor.h @@ -31,8 +31,6 @@ class FormatProcessor /// \brief Create formatter for given query spec and output stream. FormatProcessor(const QuerySpec&, OutputStream&); - ~FormatProcessor(); - /// \brief Add snapshot record to formatter. void process_record(CaliperMetadataAccessInterface&, const EntryList&); diff --git a/include/caliper/reader/Preprocessor.h b/include/caliper/reader/Preprocessor.h index 34fe34e8..e98d640b 100644 --- a/include/caliper/reader/Preprocessor.h +++ b/include/caliper/reader/Preprocessor.h @@ -30,8 +30,6 @@ class Preprocessor Preprocessor(const QuerySpec& spec); - ~Preprocessor(); - EntryList process(CaliperMetadataAccessInterface&, const EntryList&); void operator() (CaliperMetadataAccessInterface& db, const EntryList& rec, SnapshotProcessFn push) diff --git a/include/caliper/reader/QueryProcessor.h b/include/caliper/reader/QueryProcessor.h index c6495f13..2f6b46e5 100644 --- a/include/caliper/reader/QueryProcessor.h +++ b/include/caliper/reader/QueryProcessor.h @@ -29,8 +29,6 @@ class QueryProcessor QueryProcessor(const QuerySpec&, OutputStream& stream); - ~QueryProcessor(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); void flush(CaliperMetadataAccessInterface&); diff --git a/include/caliper/reader/RecordSelector.h b/include/caliper/reader/RecordSelector.h index b69d1e92..86ea5fd5 100644 --- a/include/caliper/reader/RecordSelector.h +++ b/include/caliper/reader/RecordSelector.h @@ -31,8 +31,6 @@ class RecordSelector RecordSelector(const QuerySpec& spec); RecordSelector(const QuerySpec::Condition& cond); - ~RecordSelector(); - bool pass(const CaliperMetadataAccessInterface&, const EntryList&); void operator() (CaliperMetadataAccessInterface&, const EntryList&, SnapshotProcessFn) const; diff --git a/src/caliper/controllers/HatchetRegionProfileController.cpp b/src/caliper/controllers/HatchetRegionProfileController.cpp index 5c4243af..72b13d73 100644 --- a/src/caliper/controllers/HatchetRegionProfileController.cpp +++ b/src/caliper/controllers/HatchetRegionProfileController.cpp @@ -140,12 +140,9 @@ const char* controller_spec = R"json( "category": "metric", "description": "Add inclusive time metric", "query": - [ - { - "level" : "local", - "select" : [ "inclusive_scale(sum#time.duration.ns,1e-9) as \"time (inc)\" unit sec" ] - } - ] + { + "local": "select inclusive_scale(sum#time.duration.ns,1e-9) as \"time (inc)\" unit sec" + } } ] } diff --git a/src/caliper/controllers/HatchetSampleProfileController.cpp b/src/caliper/controllers/HatchetSampleProfileController.cpp index 6f4e91b8..d96fad2c 100644 --- a/src/caliper/controllers/HatchetSampleProfileController.cpp +++ b/src/caliper/controllers/HatchetSampleProfileController.cpp @@ -83,7 +83,7 @@ class HatchetSampleProfileController : public cali::ChannelController } else { config()["CALI_SERVICES_ENABLE"].append(",report"); config()["CALI_REPORT_FILENAME"] = output; - config()["CALI_REPORT_CONFIG"] = opts.build_query("local", query); + config()["CALI_REPORT_CONFIG"] = opts.build_query("local", query); } opts.update_channel_config(config()); @@ -143,7 +143,7 @@ const char* controller_spec = R"json( "services" : [ "sampler", "trace" ], "categories" : [ "adiak", "metadata", "sampling", "output" ], "config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" }, - "defaults" : { "callpath": "true", "source.module": "true" }, + "defaults" : { "callpath": "false", "source.module": "true", "source.function": "true" }, "options": [ { @@ -160,11 +160,9 @@ const char* controller_spec = R"json( "description": "Perform call-stack unwinding", "services": [ "callpath", "symbollookup" ], "query": - [ - { "level": "local", "group by": "source.function#callpath.address", - "select": [ "source.function#callpath.address" ] - } - ] + { + "local": "select source.function#callpath.address group by source.function#callpath.address" + } },{ "name": "use.mpi", "type": "bool", diff --git a/src/caliper/controllers/RuntimeReportController.cpp b/src/caliper/controllers/RuntimeReportController.cpp index 43dc2072..bf26a1c1 100644 --- a/src/caliper/controllers/RuntimeReportController.cpp +++ b/src/caliper/controllers/RuntimeReportController.cpp @@ -143,16 +143,10 @@ const char* runtime_report_spec = R"json( "type": "bool", "description": "Order tree branches by highest exclusive runtime", "query": - [ - { - "level": "local", - "order by": [ "sum#report.time\ desc" ] - },{ - "level": "cross", - "aggregate": "sum(sum#report.time)", - "order by" : [ "sum#sum#report.time\ desc" ] - } - ] + { + "local": "order by sum#report.time desc", + "cross": "aggregate sum(sum#report.time) order by sum#sum#report.time desc" + } },{ "name": "output.append", "type": "bool", diff --git a/src/caliper/controllers/controllers.cpp b/src/caliper/controllers/controllers.cpp index c1dafa2f..c8d7c020 100644 --- a/src/caliper/controllers/controllers.cpp +++ b/src/caliper/controllers/controllers.cpp @@ -593,11 +593,11 @@ const char* builtin_gotcha_option_specs = R"json( max(max#alloc.size) as \"Max Bytes/alloc\"", "cross": "select - max(max#alloc.region.highwatermark) as \"Mem HWM\", + max(max#max#alloc.region.highwatermark) as \"Mem HWM\", max(max#alloc.tally) as \"Alloc tMax\", sum(sum#alloc.count) as \"Alloc count\", - avg(avg#alloc.size) as \"Avg Bytes/alloc\", - max(max#alloc.size) as \"Max Bytes/alloc\"" + avg(avg#avg#alloc.size) as \"Avg Bytes/alloc\", + max(max#max#alloc.size) as \"Max Bytes/alloc\"" } },{ "name": "mem.pages", diff --git a/src/reader/Aggregator.cpp b/src/reader/Aggregator.cpp index 57076706..c6b75998 100644 --- a/src/reader/Aggregator.cpp +++ b/src/reader/Aggregator.cpp @@ -92,15 +92,19 @@ class AggregationAttributeManager } }; -inline void apply_to_matching_entries(CaliperMetadataAccessInterface& db, AggregationAttributeManager& attr, const std::vector& rec, std::function F) +inline int apply_to_matching_entries(CaliperMetadataAccessInterface& db, AggregationAttributeManager& attr, const std::vector& rec, std::function F) { if (!attr.derived_attr(db)) - return; + return 0; cali_id_t tgt_attr_id = attr.target_attr(db).id(); cali_id_t drv_attr_id = attr.derived_attr(db).id(); + int count = 0; for (const Entry& e : rec) - if (e.node()->id() == tgt_attr_id || e.node()->id() == drv_attr_id) + if (e.node()->id() == tgt_attr_id || e.node()->id() == drv_attr_id) { F(e); + ++count; + } + return count; } class AggregateKernelConfig; @@ -113,7 +117,7 @@ class AggregateKernel // For inclusive metrics, parent_aggregate is invoked for parent nodes virtual void parent_aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) { aggregate(db, list); } - virtual void aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) = 0; + virtual int aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) = 0; virtual void append_result(CaliperMetadataAccessInterface& db, EntryList& list) = 0; }; @@ -152,17 +156,18 @@ class CountKernel : public AggregateKernel CountKernel(Config* config) : m_count(0), m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override { Attribute count_attr = m_config->attr(db); cali_id_t count_attr_id = count_attr.id(); for (const Entry& e : list) if (e.attribute() == count_attr_id) { m_count += e.value().to_uint(); - return; + return 1; } ++m_count; + return 1; } void append_result(CaliperMetadataAccessInterface& db, EntryList& list) override @@ -207,16 +212,17 @@ class ScaledCountKernel : public AggregateKernel ScaledCountKernel(Config* config) : m_count(0), m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override { Attribute count_attr = m_config->m_count_attr.get(db); for (const Entry& e : list) if (e.attribute() == count_attr.id()) { m_count += e.value().to_uint(); - return; + return 1; } ++m_count; + return 1; } void append_result(CaliperMetadataAccessInterface& db, EntryList& list) override @@ -271,9 +277,9 @@ class SumKernel : public AggregateKernel SumKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_sum += e.value(); }); + return apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_sum += e.value(); }); } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -330,9 +336,9 @@ class ScaledSumKernel : public AggregateKernel ScaledSumKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->sum_attr(), rec, [this](const Entry& e){ m_sum += e.value(); }); + return apply_to_matching_entries(db, m_config->sum_attr(), rec, [this](const Entry& e){ m_sum += e.value(); }); } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -383,9 +389,9 @@ class MinKernel : public AggregateKernel MinKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_min.min(e.value()); } ); + return apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_min.min(e.value()); } ); } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -434,9 +440,9 @@ class MaxKernel : public AggregateKernel MaxKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_max.max(e.value()); }); + return apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e){ m_max.max(e.value()); }); } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -478,24 +484,30 @@ class AvgKernel : public AggregateKernel AvgKernel(Config* config) : m_count(0), m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override { Attribute tgt_attr = m_config->m_sum_attr.target_attr(db); if (!tgt_attr) - return; + return 0; Attribute sum_attr = m_config->m_sum_attr.derived_attr(db); Attribute count_attr = m_config->m_count_attr.get(db); + int count = 0; for (const Entry& e : list) { if (e.attribute() == tgt_attr.id()) { m_sum += e.value(); ++m_count; + ++count; } else if (e.attribute() == sum_attr.id()) { m_sum += e.value(); + ++count; } else if (e.attribute() == count_attr.id()) { m_count += e.value().to_uint(); + ++count; } } + + return count; } void append_result(CaliperMetadataAccessInterface& db, EntryList& list) override @@ -565,10 +577,12 @@ class ScaledRatioKernel : public AggregateKernel ScaledRatioKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->m_tgt1, rec, [this](const Entry& e){ m_sum1 += e.value(); }); - apply_to_matching_entries(db, m_config->m_tgt2, rec, [this](const Entry& e){ m_sum2 += e.value(); }); + int count = 0; + count += apply_to_matching_entries(db, m_config->m_tgt1, rec, [this](const Entry& e){ m_sum1 += e.value(); }); + count += apply_to_matching_entries(db, m_config->m_tgt2, rec, [this](const Entry& e){ m_sum2 += e.value(); }); + return count; } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -643,9 +657,9 @@ class PercentTotalKernel : public AggregateKernel PercentTotalKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { - apply_to_matching_entries(db, m_config->sum_attr(), rec, [this](const Entry& e){ + return apply_to_matching_entries(db, m_config->sum_attr(), rec, [this](const Entry& e){ m_sum += e.value(); m_isum += e.value(); m_config->add(e.value()); @@ -701,10 +715,11 @@ class AnyKernel : public AggregateKernel AnyKernel(Config* config) : m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& rec) override { if (m_val.empty()) - apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e) { m_val = e.value(); }); + return apply_to_matching_entries(db, m_config->attr(), rec, [this](const Entry& e) { m_val = e.value(); }); + return 1; } void append_result(CaliperMetadataAccessInterface& db, EntryList& rec) override @@ -778,28 +793,35 @@ class VarianceKernel : public AggregateKernel VarianceKernel(Config* config) : m_count(0), m_sum(0.0), m_sqsum(0.0), m_config(config) {} - void aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override + int aggregate(CaliperMetadataAccessInterface& db, const EntryList& list) override { Attribute target_attr = m_config->get_target_attr(db); StatisticsAttributes stat_attr; if (!m_config->get_statistics_attributes(db, stat_attr)) - return; + return 0; + int count = 0; for (const Entry& e : list) { if (e.attribute() == target_attr.id()) { double v = e.value().to_double(); m_sum += v; m_sqsum += (v * v); ++m_count; + ++count; } else if (e.attribute() == stat_attr.sum.id()) { m_sum += e.value().to_double(); + ++count; } else if (e.attribute() == stat_attr.sqsum.id()) { m_sqsum += e.value().to_double(); + ++count; } else if (e.attribute() == stat_attr.count.id()) { m_count += e.value().to_uint(); + ++count; } } + + return count; } void append_result(CaliperMetadataAccessInterface& db, EntryList& list) override @@ -905,7 +927,6 @@ struct Aggregator::AggregatorImpl { std::vector m_key_strings; std::vector m_key_attrs; - std::mutex m_key_lock; bool m_select_all; bool m_select_nested; @@ -918,10 +939,11 @@ struct Aggregator::AggregatorImpl { std::size_t next_entry_idx; }; - std::vector> m_entries; + std::vector> m_entries; std::vector m_hashmap; - std::mutex m_entries_lock; + + std::mutex m_lock; // // --- parse config @@ -979,10 +1001,8 @@ struct Aggregator::AggregatorImpl { // --- snapshot processing // - std::vector update_key_attributes(CaliperMetadataAccessInterface& db) + void update_key_attributes(CaliperMetadataAccessInterface& db) { - std::lock_guard g(m_key_lock); - auto it = m_key_strings.begin(); while (it != m_key_strings.end()) { Attribute attr = db.get_attribute(*it); @@ -992,17 +1012,11 @@ struct Aggregator::AggregatorImpl { } else ++it; } - - return m_key_attrs; } - inline bool is_key( - const CaliperMetadataAccessInterface& db, - const std::vector& key_attrs, - Attribute attr - ) + inline bool is_key(Attribute attr) { - for (const Attribute& key_attr : key_attrs) { + for (const Attribute& key_attr : m_key_attrs) { if (key_attr == attr) return true; if (!attr.get(key_attr).empty()) @@ -1012,32 +1026,14 @@ struct Aggregator::AggregatorImpl { return false; } - std::shared_ptr get_aggregation_entry( - std::vector::const_iterator nodes_begin, - std::vector::const_iterator nodes_end, - const std::vector& immediates, - CaliperMetadataAccessInterface& db - ) + AggregateEntry* get_aggregation_entry(const std::vector& key) { - // --- make key from key nodes and immediates - - std::vector key; - key.reserve(immediates.size() + 1); - key.insert(key.end(), immediates.begin(), immediates.end()); - - if (nodes_begin != nodes_end) { - std::vector rv_nodes(nodes_end - nodes_begin); - std::reverse_copy(nodes_begin, nodes_end, rv_nodes.begin()); - key.push_back(Entry(db.make_tree_entry(rv_nodes.size(), rv_nodes.data()))); - } - // --- lookup key std::size_t hash = compute_key_hash(key) % m_hashmap.size(); for (size_t i = m_hashmap[hash]; i; i = m_entries[i]->next_entry_idx) { - auto e = m_entries[i]; - if (key == e->key) - return e; + if (key == m_entries[i]->key) + return m_entries[i].get(); } // --- hash key not found: create a new entry @@ -1048,76 +1044,81 @@ struct Aggregator::AggregatorImpl { for (AggregateKernelConfig* k_cfg : m_kernel_configs) kernels.emplace_back(k_cfg->make_kernel()); - auto e = std::make_shared(); - - e->key = std::move(key); - e->kernels = std::move(kernels); - e->next_entry_idx = m_hashmap[hash]; - size_t idx = m_entries.size(); - m_entries.push_back(e); + m_entries.emplace_back(new AggregateEntry { std::move(key), std::move(kernels), m_hashmap[hash] }); m_hashmap[hash] = idx; - return e; + return m_entries[idx].get(); } void process(CaliperMetadataAccessInterface& db, const EntryList& rec) { - std::vector key_attrs = update_key_attributes(db); + std::lock_guard g(m_lock); + update_key_attributes(db); // --- Unravel nodes, filter for key attributes - std::vector nodes; - std::vector non_path_nodes; - std::vector immediates; + std::vector path_nodes; + std::vector non_path_nodes; + std::vector key; - nodes.reserve(80); - immediates.reserve(key_attrs.size()); + path_nodes.reserve(32); + non_path_nodes.reserve(32); + key.reserve(2 + m_key_attrs.size()); for (const Entry& e : rec) { if (e.is_reference()) { for (Node* node = e.node(); node && node->attribute() != CALI_INV_ID; node = node->parent()) { Attribute attr = db.get_attribute(node->attribute()); bool is_nested = attr.is_nested(); - if (m_select_all || (m_select_nested && is_nested) || is_key(db, key_attrs, attr)) { + if (m_select_all || (m_select_nested && is_nested) || is_key(attr)) { if (is_nested) - nodes.push_back(node); + path_nodes.push_back(node); else non_path_nodes.push_back(node); } } - } else if (is_key(db, key_attrs, db.get_attribute(e.attribute()))) { + } else if (is_key(db.get_attribute(e.attribute()))) { // Only include explicitly selected immediate entries in the key. - immediates.push_back(e); + key.emplace_back(e); } } // --- Canonicalize key by sorting by attribute ids - std::stable_sort(non_path_nodes.begin(), non_path_nodes.end(), [](const Node* a, const Node* b) { - return a->attribute() < b->attribute(); - }); - std::sort(immediates.begin(), immediates.end(), [](const Entry& a, const Entry& b) { + std::sort(key.begin(), key.end(), [](const Entry& a, const Entry& b) { return a.attribute() < b.attribute(); }); - auto nonnested_begin = nodes.insert(nodes.end(), non_path_nodes.begin(), non_path_nodes.end()); + // --- Make node entry for non-path nodes and put it in the key - std::lock_guard g(m_entries_lock); + if (!non_path_nodes.empty()) { + std::reverse(non_path_nodes.begin(), non_path_nodes.end()); + key.emplace_back(db.make_tree_entry(non_path_nodes.size(), non_path_nodes.data())); + } + + // --- Add path entry to key - auto entry = get_aggregation_entry(nodes.begin(), nodes.end(), immediates, db); + Node* path_node = nullptr; + + if (!path_nodes.empty()) { + std::reverse(path_nodes.begin(), path_nodes.end()); + path_node = db.make_tree_entry(path_nodes.size(), path_nodes.data()); + key.emplace_back(path_node); + } // --- Aggregate + AggregateEntry* entry = get_aggregation_entry(key); + for (size_t k = 0; k < entry->kernels.size(); ++k) { - entry->kernels[k]->aggregate(db, rec); + int matches = entry->kernels[k]->aggregate(db, rec); // for inclusive kernels, aggregate for all parent nodes as well - if (m_kernel_configs[k]->is_inclusive() && nodes.begin() != nonnested_begin) { - auto it = nodes.begin(); - - for (++it; it != nonnested_begin; ++it) { - auto p_entry = get_aggregation_entry(it, nodes.end(), immediates, db); + if (m_kernel_configs[k]->is_inclusive() && (matches > 0) && path_node) { + for (Node* node = path_node->parent(); node && node->attribute() != CALI_INV_ID; node = node->parent()) { + key.back() = Entry(node); + AggregateEntry* p_entry = get_aggregation_entry(key); p_entry->kernels[k]->parent_aggregate(db, rec); } } @@ -1130,7 +1131,7 @@ struct Aggregator::AggregatorImpl { void flush(CaliperMetadataAccessInterface& db, const SnapshotProcessFn push) { - std::lock_guard g(m_entries_lock); + std::lock_guard g(m_lock); for (const auto &entry : m_entries) { if (!entry) @@ -1149,7 +1150,7 @@ struct Aggregator::AggregatorImpl { m_entries.reserve(4096); m_hashmap.assign(4096, static_cast(0)); // zero marks the end of the hash chain, so we must block out slot 0 for actual entries - m_entries.push_back(std::shared_ptr(nullptr)); + m_entries.emplace_back(std::unique_ptr()); } ~AggregatorImpl() @@ -1164,11 +1165,6 @@ struct Aggregator::AggregatorImpl { Aggregator::Aggregator(const QuerySpec& spec) : mP { new AggregatorImpl(spec) } {} -Aggregator::~Aggregator() -{ - mP.reset(); -} - void Aggregator::flush(CaliperMetadataAccessInterface& db, SnapshotProcessFn push) { mP->flush(db, push); diff --git a/src/reader/CaliReader.cpp b/src/reader/CaliReader.cpp index 96ebe54d..bf8479a0 100644 --- a/src/reader/CaliReader.cpp +++ b/src/reader/CaliReader.cpp @@ -142,7 +142,7 @@ struct CaliReader::CaliReaderImpl { m_error_msg = msg; } - void read_node(fast_istringstream& is, CaliperMetadataDB& db, IdMap& idmap, NodeProcessFn node_proc) + void read_node(fast_istringstream& is, CaliperMetadataDB& db, IdMap& idmap, NodeProcessFn& node_proc) { cali_id_t attr_id = CALI_INV_ID; cali_id_t node_id = CALI_INV_ID; @@ -175,7 +175,7 @@ struct CaliReader::CaliReaderImpl { set_error("Invalid node record"); } - void read_snapshot(fast_istringstream& is, CaliperMetadataDB& db, IdMap& idmap, SnapshotProcessFn snap_proc) + void read_snapshot(fast_istringstream& is, CaliperMetadataDB& db, IdMap& idmap, SnapshotProcessFn& snap_proc) { std::vector refs; std::vector attr; @@ -236,8 +236,8 @@ struct CaliReader::CaliReaderImpl { fast_istringstream& is, CaliperMetadataDB& db, IdMap& idmap, - NodeProcessFn node_proc, - SnapshotProcessFn snap_proc + NodeProcessFn& node_proc, + SnapshotProcessFn& snap_proc ) { if (is.matches(11, "__rec=node,")) { diff --git a/src/reader/CaliWriter.cpp b/src/reader/CaliWriter.cpp index 6c3335d9..7b87667b 100644 --- a/src/reader/CaliWriter.cpp +++ b/src/reader/CaliWriter.cpp @@ -155,11 +155,6 @@ struct CaliWriter::CaliWriterImpl { CaliWriter::CaliWriter(OutputStream& os) : mP(new CaliWriterImpl(os)) {} -CaliWriter::~CaliWriter() -{ - mP.reset(); -} - size_t CaliWriter::num_written() const { return mP ? mP->m_num_written : 0; diff --git a/src/reader/Expand.cpp b/src/reader/Expand.cpp index 468843a4..67918bbb 100644 --- a/src/reader/Expand.cpp +++ b/src/reader/Expand.cpp @@ -149,11 +149,6 @@ Expand::Expand(OutputStream& os, const QuerySpec& spec) : mP { new ExpandImpl(os mP->configure(spec); } -Expand::~Expand() -{ - mP.reset(); -} - void Expand::operator() (CaliperMetadataAccessInterface& db, const EntryList& list) const { mP->print(db, list); diff --git a/src/reader/Expand.h b/src/reader/Expand.h index 23539a22..63f5a55a 100644 --- a/src/reader/Expand.h +++ b/src/reader/Expand.h @@ -31,8 +31,6 @@ class Expand : public Formatter Expand(OutputStream& os, const std::string& filter_string); Expand(OutputStream& os, const QuerySpec& spec); - ~Expand(); - void operator() (CaliperMetadataAccessInterface&, const EntryList&) const; void process_record(CaliperMetadataAccessInterface&, const EntryList&); diff --git a/src/reader/FormatProcessor.cpp b/src/reader/FormatProcessor.cpp index ec751ff3..fe2e9cd8 100644 --- a/src/reader/FormatProcessor.cpp +++ b/src/reader/FormatProcessor.cpp @@ -102,11 +102,6 @@ FormatProcessor::FormatProcessor(const QuerySpec& spec, OutputStream& stream) : mP(new FormatProcessorImpl(stream, spec)) {} -FormatProcessor::~FormatProcessor() -{ - mP.reset(); -} - const QuerySpec::FunctionSignature* FormatProcessor::formatter_defs() { return ::formatters; diff --git a/src/reader/JsonFormatter.cpp b/src/reader/JsonFormatter.cpp index 63a888cd..4f7e655e 100644 --- a/src/reader/JsonFormatter.cpp +++ b/src/reader/JsonFormatter.cpp @@ -302,11 +302,6 @@ JsonFormatter::JsonFormatter(OutputStream& os, const QuerySpec& spec) : mP { new mP->configure(spec); } -JsonFormatter::~JsonFormatter() -{ - mP.reset(); -} - void JsonFormatter::process_record(CaliperMetadataAccessInterface& db, const EntryList& list) { mP->print(db, list); diff --git a/src/reader/JsonFormatter.h b/src/reader/JsonFormatter.h index d722804b..b56610e5 100644 --- a/src/reader/JsonFormatter.h +++ b/src/reader/JsonFormatter.h @@ -29,8 +29,6 @@ class JsonFormatter : public Formatter JsonFormatter(OutputStream& os, const QuerySpec& spec); - ~JsonFormatter(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); void flush(CaliperMetadataAccessInterface&, std::ostream& os); diff --git a/src/reader/JsonSplitFormatter.cpp b/src/reader/JsonSplitFormatter.cpp index a4abfdae..ddca4c10 100644 --- a/src/reader/JsonSplitFormatter.cpp +++ b/src/reader/JsonSplitFormatter.cpp @@ -423,11 +423,6 @@ JsonSplitFormatter::JsonSplitFormatter(const QuerySpec& spec) : mP { new JsonSpl mP->configure(spec); } -JsonSplitFormatter::~JsonSplitFormatter() -{ - mP.reset(); -} - void JsonSplitFormatter::process_record(CaliperMetadataAccessInterface& db, const EntryList& list) { mP->process_record(db, list); diff --git a/src/reader/JsonSplitFormatter.h b/src/reader/JsonSplitFormatter.h index 94f3a461..ff9df231 100644 --- a/src/reader/JsonSplitFormatter.h +++ b/src/reader/JsonSplitFormatter.h @@ -27,8 +27,6 @@ class JsonSplitFormatter : public Formatter JsonSplitFormatter(const QuerySpec& spec); - ~JsonSplitFormatter(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); void flush(CaliperMetadataAccessInterface&, std::ostream& os); diff --git a/src/reader/Preprocessor.cpp b/src/reader/Preprocessor.cpp index 0d69c39a..c8161d77 100644 --- a/src/reader/Preprocessor.cpp +++ b/src/reader/Preprocessor.cpp @@ -396,9 +396,6 @@ struct Preprocessor::PreprocessorImpl { Preprocessor::Preprocessor(const QuerySpec& spec) : mP(new PreprocessorImpl(spec)) {} -Preprocessor::~Preprocessor() -{} - EntryList Preprocessor::process(CaliperMetadataAccessInterface& db, const EntryList& rec) { return mP->process(db, rec); diff --git a/src/reader/QueryProcessor.cpp b/src/reader/QueryProcessor.cpp index c0234708..8bbe472a 100644 --- a/src/reader/QueryProcessor.cpp +++ b/src/reader/QueryProcessor.cpp @@ -48,11 +48,6 @@ struct QueryProcessor::QueryProcessorImpl { QueryProcessor::QueryProcessor(const QuerySpec& spec, OutputStream& stream) : mP(new QueryProcessorImpl(spec, stream)) {} -QueryProcessor::~QueryProcessor() -{ - mP.reset(); -} - void QueryProcessor::process_record(CaliperMetadataAccessInterface& db, const EntryList& rec) { diff --git a/src/reader/RecordSelector.cpp b/src/reader/RecordSelector.cpp index fe8f52b3..14161e33 100644 --- a/src/reader/RecordSelector.cpp +++ b/src/reader/RecordSelector.cpp @@ -262,11 +262,6 @@ RecordSelector::RecordSelector(const QuerySpec::Condition& cond) : mP { new Reco mP->configure(cond); } -RecordSelector::~RecordSelector() -{ - mP.reset(); -} - bool RecordSelector::pass(const CaliperMetadataAccessInterface& db, const EntryList& list) { return mP->pass(db, list); diff --git a/src/reader/SnapshotTree.cpp b/src/reader/SnapshotTree.cpp index f82330e7..d9cb9a69 100644 --- a/src/reader/SnapshotTree.cpp +++ b/src/reader/SnapshotTree.cpp @@ -186,11 +186,6 @@ SnapshotTree::SnapshotTree() : mP(new SnapshotTreeImpl(Attribute(), Variant())) SnapshotTree::SnapshotTree(const Attribute& attr, const Variant& value) : mP(new SnapshotTreeImpl(attr, value)) {} -SnapshotTree::~SnapshotTree() -{ - mP.reset(); -} - const SnapshotTreeNode* SnapshotTree::add_snapshot( const CaliperMetadataAccessInterface& db, const EntryList& list, diff --git a/src/reader/SnapshotTree.h b/src/reader/SnapshotTree.h index 3c860acc..aaf2755f 100644 --- a/src/reader/SnapshotTree.h +++ b/src/reader/SnapshotTree.h @@ -142,8 +142,6 @@ class SnapshotTree /// \brief Create root node with label (\a attr, \a value). SnapshotTree(const Attribute& attr, const Variant& value); - ~SnapshotTree(); - /// A predicate to determine if a given _(attribute,value)_ pair /// in a snapshot record belongs to the tree path or not. typedef std::function IsPathPredicateFn; diff --git a/src/reader/TableFormatter.cpp b/src/reader/TableFormatter.cpp index fc350770..2726707c 100644 --- a/src/reader/TableFormatter.cpp +++ b/src/reader/TableFormatter.cpp @@ -355,11 +355,6 @@ TableFormatter::TableFormatter(const QuerySpec& spec) : mP { new TableImpl } mP->configure(spec); } -TableFormatter::~TableFormatter() -{ - mP.reset(); -} - void TableFormatter::process_record(CaliperMetadataAccessInterface& db, const EntryList& list) { mP->add(db, list); diff --git a/src/reader/TableFormatter.h b/src/reader/TableFormatter.h index 6d58ad58..18884c1f 100644 --- a/src/reader/TableFormatter.h +++ b/src/reader/TableFormatter.h @@ -31,8 +31,6 @@ class TableFormatter : public Formatter TableFormatter(const std::string& fields, const std::string& sort_fields); TableFormatter(const QuerySpec& spec); - ~TableFormatter(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); void flush(CaliperMetadataAccessInterface&, std::ostream& os); diff --git a/src/reader/TreeFormatter.cpp b/src/reader/TreeFormatter.cpp index 1e710f12..924f4891 100644 --- a/src/reader/TreeFormatter.cpp +++ b/src/reader/TreeFormatter.cpp @@ -401,11 +401,6 @@ struct TreeFormatter::TreeFormatterImpl { TreeFormatter::TreeFormatter(const QuerySpec& spec) : mP { new TreeFormatterImpl(spec) } {} -TreeFormatter::~TreeFormatter() -{ - mP.reset(); -} - void TreeFormatter::process_record(CaliperMetadataAccessInterface& db, const EntryList& list) { mP->add(db, list); diff --git a/src/reader/TreeFormatter.h b/src/reader/TreeFormatter.h index 3de6effd..3b921dd8 100644 --- a/src/reader/TreeFormatter.h +++ b/src/reader/TreeFormatter.h @@ -29,8 +29,6 @@ class TreeFormatter : public Formatter TreeFormatter(const QuerySpec& spec); - ~TreeFormatter(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); void flush(CaliperMetadataAccessInterface&, std::ostream& os); diff --git a/src/reader/UserFormatter.cpp b/src/reader/UserFormatter.cpp index e38537f8..1e65784f 100644 --- a/src/reader/UserFormatter.cpp +++ b/src/reader/UserFormatter.cpp @@ -171,11 +171,6 @@ UserFormatter::UserFormatter(OutputStream& os, const QuerySpec& spec) : mP { new } } -UserFormatter::~UserFormatter() -{ - mP.reset(); -} - void UserFormatter::process_record(CaliperMetadataAccessInterface& db, const EntryList& list) { mP->print(db, list); diff --git a/src/reader/UserFormatter.h b/src/reader/UserFormatter.h index 21daa156..b43673fc 100644 --- a/src/reader/UserFormatter.h +++ b/src/reader/UserFormatter.h @@ -30,8 +30,6 @@ class UserFormatter : public Formatter UserFormatter(OutputStream& os, const QuerySpec& spec); - ~UserFormatter(); - void process_record(CaliperMetadataAccessInterface&, const EntryList&); }; diff --git a/src/tools/cali-query/cali-query.cpp b/src/tools/cali-query/cali-query.cpp index a8163078..ec34a51b 100644 --- a/src/tools/cali-query/cali-query.cpp +++ b/src/tools/cali-query/cali-query.cpp @@ -171,32 +171,29 @@ int main(int argc, const char* argv[]) { Args args(::option_table); - // The Caliper config setup must run before Caliper runtime initialization - setup_caliper_config(args); - ConfigManager mgr; - - // // --- Parse command line arguments - // { int i = args.parse(argc, argv); - if (i < argc) { std::cerr << "cali-query: error: unknown option: " << argv[i] << '\n' << " Available options: "; args.print_available_options(std::cerr); return -1; } + } - if (args.is_set("help")) { - print_caliquery_help(args, usage, mgr); - return 0; - } + // The Caliper config setup must run before Caliper runtime initialization + setup_caliper_config(args); + ConfigManager mgr; - if (args.is_set("version")) { - std::cerr << cali_caliper_version() << std::endl; - return 0; - } + if (args.is_set("help")) { + print_caliquery_help(args, usage, mgr); + return 0; + } + + if (args.is_set("version")) { + std::cerr << cali_caliper_version() << std::endl; + return 0; } bool verbose = args.is_set("verbose"); diff --git a/test/ci_app_tests/test_samplereport.py b/test/ci_app_tests/test_samplereport.py index 090dae74..a10552f4 100644 --- a/test/ci_app_tests/test_samplereport.py +++ b/test/ci_app_tests/test_samplereport.py @@ -56,7 +56,7 @@ def test_runtime_report_nompi(self): self.fail('%s not found in log' % target) def test_hatchet_callpath_sample_profile(self): - target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output=stdout,output.format=cali)' ] + target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output=stdout)' ] query_cmd = [ '../../src/tools/cali-query/cali-query', '-e' ] caliper_config = { @@ -69,7 +69,7 @@ def test_hatchet_callpath_sample_profile(self): self.assertTrue(len(snapshots) > 0) self.assertTrue(cat.has_snapshot_with_keys( - snapshots, { 'loop', 'region', 'source.function#callpath.address' })) + snapshots, { 'loop', 'region', 'source.function#cali.sampler.pc' })) if __name__ == "__main__": unittest.main() diff --git a/test/ci_app_tests/test_symbollookup.py b/test/ci_app_tests/test_symbollookup.py index 6f8d7cc1..b502f557 100644 --- a/test/ci_app_tests/test_symbollookup.py +++ b/test/ci_app_tests/test_symbollookup.py @@ -36,7 +36,7 @@ def test_sampler_symbollookup(self): 'region', 'loop' })) def test_hatchet_sample_profile_lookup(self): - target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output.format=json-split,output=stdout,callpath=false,source.location=true,source.module=true)' ] + target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output.format=json-split,output=stdout,callpath=false,source.location=true,source.module=true,source.function=true)' ] caliper_config = { 'CALI_LOG_VERBOSITY' : '0' @@ -44,7 +44,7 @@ def test_hatchet_sample_profile_lookup(self): obj = json.loads( cat.run_test(target_cmd, caliper_config)[0] ) - self.assertEqual(set(obj['columns']), { 'count', 'time', 'Source', 'Module', 'path' } ) + self.assertEqual(set(obj['columns']), { 'count', 'time', 'Function', 'Source', 'Module', 'path' } ) if __name__ == "__main__": unittest.main()