Skip to content

Commit 60af01f

Browse files
committed
[XPTIFW] Addressing review feedback II
Signed-off-by: Vasanth Tovinkere <[email protected]>
1 parent 9f2bc86 commit 60af01f

File tree

6 files changed

+14
-26
lines changed

6 files changed

+14
-26
lines changed

xptifw/basic_test/cl_processor.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ using titles_t = std::vector<std::string>;
3333

3434
class ScopedTimer {
3535
public:
36-
typedef std::chrono::time_point<std::chrono::high_resolution_clock>
37-
time_unit_t;
36+
using time_unit_t =
37+
std::chrono::time_point<std::chrono::high_resolution_clock>;
3838
ScopedTimer(uint64_t &ns, double &ratio, size_t count = 1)
3939
: MDuration{ns}, MAverage{ratio}, MInstances{count} {
4040
MBefore = std::chrono::high_resolution_clock::now();
@@ -60,7 +60,6 @@ class CommandLineOption {
6060
CommandLineOption()
6161
: MRequired(false), MType(OptionType::String),
6262
MHelp("No help available.") {}
63-
~CommandLineOption() {}
6463

6564
CommandLineOption &setRequired(bool yesOrNo) {
6665
MRequired = yesOrNo;
@@ -93,17 +92,15 @@ class CommandLineOption {
9392

9493
class CommandLineParser {
9594
public:
96-
typedef std::unordered_map<std::string, CommandLineOption>
97-
CommandLineOptions_t;
98-
typedef std::unordered_map<std::string, std::string> key_value_t;
95+
using CommandLineOptions_t =
96+
std::unordered_map<std::string, CommandLineOption>;
97+
using key_value_t = std::unordered_map<std::string, std::string>;
9998

10099
CommandLineParser() {
101100
MReservedKey = "--help";
102101
MReservedKeyAbbr = "-h";
103102
}
104103

105-
~CommandLineParser() {}
106-
107104
void parse(int argc, char **argv) {
108105
MCommandLineOptions.resize(argc);
109106
// Go through the command-line options list and build an internal

xptifw/include/xpti_int64_hash_table.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <unordered_map>
1212

1313
#ifdef XPTI_STATISTICS
14-
#include <stdio.h>
14+
#include <cstdio>
1515
#endif
1616

1717
#ifdef XPTI_USE_TBB

xptifw/include/xpti_string_table.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
#include "xpti_data_types.h"
88

99
#include <atomic>
10-
#include <iostream>
1110
#include <mutex>
1211
#include <unordered_map>
1312

1413
#ifdef XPTI_STATISTICS
15-
#include <stdio.h>
14+
#include <cstdio>
1615
#endif
1716

1817
#ifdef XPTI_USE_TBB

xptifw/samples/basic_collector/basic_collector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
#include "xpti_trace_framework.h"
1010

1111
#include <chrono>
12+
#include <cstdio>
1213
#include <iostream>
1314
#include <map>
1415
#include <mutex>
15-
#include <stdio.h>
1616
#include <string>
1717
#include <thread>
1818
#include <unordered_map>

xptifw/samples/include/xpti_timers.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
namespace xpti {
1616
class ThreadID {
1717
public:
18-
typedef std::unordered_map<std::string, int> thread_lut_t;
19-
20-
ThreadID() : m_tid(0) {}
21-
~ThreadID() {}
18+
using thread_lut_t = std::unordered_map<std::string, int>;
2219

2320
inline uint32_t enumID(std::thread::id &curr) {
2421
std::stringstream s;
@@ -45,13 +42,13 @@ class ThreadID {
4542
}
4643

4744
private:
48-
std::atomic<uint32_t> m_tid;
45+
std::atomic<uint32_t> m_tid = {0};
4946
thread_lut_t m_thread_lookup;
5047
};
5148

5249
namespace timer {
5350
#include <cstdint>
54-
typedef uint64_t tick_t;
51+
using tick_t = uint64_t;
5552
#if defined(_WIN32) || defined(_WIN64)
5653
#include "windows.h"
5754
inline xpti::timer::tick_t rdtsc() {

xptifw/src/xpti_trace_framework.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
#include "xpti_string_table.hpp"
99

1010
#include <cassert>
11+
#include <cstdio>
1112
#include <map>
1213
#include <mutex>
1314
#include <sstream>
1415
#include <string>
1516
#include <unordered_map>
1617
#include <vector>
1718

18-
#ifdef XPTI_STATISTICS
19-
#include <stdio.h>
20-
#endif
21-
2219
#ifdef XPTI_USE_TBB
2320
#include <tbb/concurrent_hash_map.h>
2421
#include <tbb/concurrent_unordered_map.h>
@@ -104,7 +101,6 @@ class Subscribers {
104101
#endif
105102
// This plugin has already been loaded, so let's return previously
106103
// recorded handle
107-
printf("Plugin (%s) has already been loaded..\n", Path);
108104
plugin_data_t &Data = MNameLUT[Path];
109105
assert(Data.valid && "Lookup is invalid!");
110106
if (Data.valid)
@@ -384,10 +380,12 @@ class Tracepoints {
384380
// performed.
385381
//
386382
void printStatistics() {
383+
#ifdef XPTI_STATISTICS
387384
printf("Tracepoint inserts : [%lu] \n", MInsertions.load());
388385
printf("Tracepoint lookups : [%lu]\n", MRetrievals.load());
389386
printf("Tracepoint Hashmap :\n");
390387
MPayloadLUT.printStatistics();
388+
#endif
391389
}
392390

393391
private:
@@ -646,8 +644,6 @@ class Notifications {
646644
using stream_cb_t = std::unordered_map<uint16_t, cb_t>;
647645
using statistics_t = std::unordered_map<uint16_t, uint64_t>;
648646
#endif
649-
Notifications() = default;
650-
~Notifications() = default;
651647

652648
xpti::result_t registerCallback(uint8_t StreamID, uint16_t TraceType,
653649
xpti::tracepoint_callback_api_t cbFunc) {
@@ -898,7 +894,6 @@ class Framework {
898894
MTraceEnabled =
899895
(g_helper.checkTraceEnv() && MSubscribers.hasValidSubscribers());
900896
}
901-
~Framework() = default;
902897

903898
void clear() {
904899
MUniversalIDs = {1};

0 commit comments

Comments
 (0)