Skip to content

Commit a9407c8

Browse files
authored
Remove unused code (#704)
1 parent 9556cb2 commit a9407c8

10 files changed

Lines changed: 10 additions & 97 deletions

File tree

include/caliper/reader/QueryProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class QueryProcessor
2727

2828
public:
2929

30-
QueryProcessor(const QuerySpec&, OutputStream& stream);
30+
QueryProcessor(const QuerySpec&, OutputStream&);
3131

3232
void process_record(CaliperMetadataAccessInterface&, const EntryList&);
3333
void flush(CaliperMetadataAccessInterface&);

include/caliper/reader/RecordSelector.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class RecordSelector
2727

2828
public:
2929

30-
RecordSelector(const std::string& filter_string);
3130
RecordSelector(const QuerySpec& spec);
3231
RecordSelector(const QuerySpec::Condition& cond);
3332

src/reader/Aggregator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ struct Aggregator::AggregatorImpl {
10451045
kernels.emplace_back(k_cfg->make_kernel());
10461046

10471047
size_t idx = m_entries.size();
1048-
m_entries.emplace_back(new AggregateEntry { std::move(key), std::move(kernels), m_hashmap[hash] });
1048+
m_entries.emplace_back(new AggregateEntry { key, std::move(kernels), m_hashmap[hash] });
10491049
m_hashmap[hash] = idx;
10501050

10511051
return m_entries[idx].get();

src/reader/Expand.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ using namespace cali;
2525

2626
struct Expand::ExpandImpl {
2727
std::set<std::string> m_selected;
28-
std::set<std::string> m_deselected;
2928

3029
std::map<std::string, std::string> m_aliases;
3130

@@ -35,23 +34,6 @@ struct Expand::ExpandImpl {
3534

3635
ExpandImpl(OutputStream& os) : m_os(os) {}
3736

38-
void parse(const std::string& field_string)
39-
{
40-
std::vector<std::string> fields;
41-
42-
util::split(field_string, ':', std::back_inserter(fields));
43-
44-
for (const std::string& s : fields) {
45-
if (s.size() == 0)
46-
continue;
47-
48-
if (s[0] == '-')
49-
m_deselected.insert(s.substr(1, std::string::npos));
50-
else
51-
m_selected.insert(s);
52-
}
53-
}
54-
5537
void configure(const QuerySpec& spec)
5638
{
5739
switch (spec.select.selection) {
@@ -83,7 +65,7 @@ struct Expand::ExpandImpl {
8365
for (const Node* node = e.node(); node && node->attribute() != CALI_INV_ID; node = node->parent()) {
8466
std::string name = db.get_attribute(node->attribute()).name();
8567

86-
if ((!m_selected.empty() && m_selected.count(name) == 0) || m_deselected.count(name))
68+
if ((!m_selected.empty() && m_selected.count(name) == 0))
8769
continue;
8870

8971
nodes.push_back(node);
@@ -118,7 +100,7 @@ struct Expand::ExpandImpl {
118100
} else if (e.is_immediate()) {
119101
std::string name = db.get_attribute(e.attribute()).name();
120102

121-
if ((!m_selected.empty() && m_selected.count(name) == 0) || m_deselected.count(name))
103+
if ((!m_selected.empty() && m_selected.count(name) == 0))
122104
continue;
123105

124106
{
@@ -139,21 +121,11 @@ struct Expand::ExpandImpl {
139121
}
140122
};
141123

142-
Expand::Expand(OutputStream& os, const std::string& field_string) : mP { new ExpandImpl(os) }
143-
{
144-
mP->parse(field_string);
145-
}
146-
147124
Expand::Expand(OutputStream& os, const QuerySpec& spec) : mP { new ExpandImpl(os) }
148125
{
149126
mP->configure(spec);
150127
}
151128

152-
void Expand::operator() (CaliperMetadataAccessInterface& db, const EntryList& list) const
153-
{
154-
mP->print(db, list);
155-
}
156-
157129
void Expand::process_record(CaliperMetadataAccessInterface& db, const EntryList& list)
158130
{
159131
mP->print(db, list);

src/reader/Expand.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ class Expand : public Formatter
2828

2929
public:
3030

31-
Expand(OutputStream& os, const std::string& filter_string);
3231
Expand(OutputStream& os, const QuerySpec& spec);
3332

34-
void operator() (CaliperMetadataAccessInterface&, const EntryList&) const;
35-
3633
void process_record(CaliperMetadataAccessInterface&, const EntryList&);
3734
};
3835

src/reader/JsonFormatter.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ using namespace cali;
2727

2828
struct JsonFormatter::JsonFormatterImpl {
2929
std::set<std::string> m_selected;
30-
std::set<std::string> m_deselected;
3130

3231
OutputStream m_os;
33-
3432
std::mutex m_os_lock;
3533

3634
unsigned m_num_recs = 0;
@@ -48,23 +46,6 @@ struct JsonFormatter::JsonFormatterImpl {
4846

4947
JsonFormatterImpl(OutputStream& os) : m_os(os) {}
5048

51-
void parse(const std::string& field_string)
52-
{
53-
std::vector<std::string> fields;
54-
55-
util::split(field_string, ':', std::back_inserter(fields));
56-
57-
for (const std::string& s : fields) {
58-
if (s.size() == 0)
59-
continue;
60-
61-
if (s[0] == '-')
62-
m_deselected.insert(s.substr(1, std::string::npos));
63-
else
64-
m_selected.insert(s);
65-
}
66-
}
67-
6849
void configure(const QuerySpec& spec)
6950
{
7051
for (auto p : spec.format.kwargs) {
@@ -102,7 +83,7 @@ struct JsonFormatter::JsonFormatterImpl {
10283
{
10384
std::string name = attr.name();
10485

105-
bool selected = m_selected.count(name) > 0 && !(m_deselected.count(name) > 0);
86+
bool selected = m_selected.count(name) > 0;
10687

10788
if (!selected && (!m_selected.empty() || attr.is_hidden() || attr.is_global()))
10889
return "";

src/reader/RecordSelector.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,6 @@ struct RecordSelector::RecordSelectorImpl {
247247
}
248248
}; // RecordSelectorImpl
249249

250-
RecordSelector::RecordSelector(const std::string& filter_string) : mP { new RecordSelectorImpl }
251-
{
252-
mP->m_filters = parse(filter_string);
253-
}
254-
255250
RecordSelector::RecordSelector(const QuerySpec& spec) : mP { new RecordSelectorImpl }
256251
{
257252
mP->configure(spec);

src/reader/TableFormatter.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,6 @@ struct TableFormatter::TableImpl {
6767
return std::max(m_max_column_width > 0 ? std::min(base, m_max_column_width) : base, 4);
6868
}
6969

70-
void parse(const std::string& field_string, const std::string& sort_string)
71-
{
72-
std::vector<std::string> fields;
73-
74-
// fill sort columns
75-
76-
util::split(sort_string, ':', std::back_inserter(fields));
77-
78-
for (const std::string& s : fields)
79-
if (s.size() > 0)
80-
m_cols.emplace_back(s, s, s.size(), Attribute(), false);
81-
82-
fields.clear();
83-
84-
// fill print columns
85-
86-
if (field_string.empty()) {
87-
m_auto_column = true;
88-
return;
89-
} else
90-
m_auto_column = false;
91-
92-
util::split(field_string, ':', std::back_inserter(fields));
93-
94-
for (const std::string& s : fields)
95-
if (s.size() > 0)
96-
m_cols.emplace_back(s, s, s.size(), Attribute(), true);
97-
}
98-
9970
void configure(const QuerySpec& spec)
10071
{
10172
m_cols.clear();
@@ -345,11 +316,6 @@ struct TableFormatter::TableImpl {
345316
TableImpl() : m_max_column_width(60), m_print_globals(false) {}
346317
};
347318

348-
TableFormatter::TableFormatter(const std::string& fields, const std::string& sort_fields) : mP { new TableImpl }
349-
{
350-
mP->parse(fields, sort_fields);
351-
}
352-
353319
TableFormatter::TableFormatter(const QuerySpec& spec) : mP { new TableImpl }
354320
{
355321
mP->configure(spec);

src/reader/TableFormatter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class TableFormatter : public Formatter
2828

2929
public:
3030

31-
TableFormatter(const std::string& fields, const std::string& sort_fields);
3231
TableFormatter(const QuerySpec& spec);
3332

3433
void process_record(CaliperMetadataAccessInterface&, const EntryList&);

src/services/validator/validator.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "caliper/common/Node.h"
1616
#include "caliper/common/OutputStream.h"
1717

18+
#include "caliper/reader/QuerySpec.h"
19+
1820
#include "../../reader/Expand.h"
1921

2022
#include <atomic>
@@ -39,8 +41,10 @@ std::ostream& print_snapshot(Caliper* c, std::ostream& os)
3941

4042
OutputStream stream;
4143
stream.set_stream(&os);
44+
QuerySpec spec;
45+
spec.select.selection = QuerySpec::AttributeSelection::Default;
4246

43-
cali::Expand exp(stream, "");
47+
cali::Expand exp(stream, spec);
4448
exp.process_record(*c, std::vector<Entry>(snapshot.view().begin(), snapshot.view().end()));
4549

4650
return os << " }";

0 commit comments

Comments
 (0)