Skip to content

Commit

Permalink
Some IWYU changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nealsid committed Sep 30, 2022
1 parent 9e1f80b commit 23108b1
Show file tree
Hide file tree
Showing 42 changed files with 309 additions and 184 deletions.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,14 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
# Daemon & client
file(GLOB DAEMON_SOURCES "daemon/*.cpp")
add_executable(daemon ${DAEMON_SOURCES})
target_include_directories(daemon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(daemon PRIVATE PCM_STATIC Threads::Threads)
set_target_properties(daemon PROPERTIES OUTPUT_NAME "pcm-daemon")
install(TARGETS daemon DESTINATION ${CMAKE_INSTALL_SBINDIR})

file(GLOB CLIENT_SOURCES "client/*.cpp")
add_executable(client ${CLIENT_SOURCES})
target_include_directories(client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(client PRIVATE Threads::Threads)
set_target_properties(client PROPERTIES OUTPUT_NAME "pcm-client")
install(TARGETS client DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down
4 changes: 3 additions & 1 deletion src/bw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//

#include <iostream>
#include <exception>
#include "mmio.h"
#include "bw.h"
#include "pci.h"
#include "utils.h"
Expand Down Expand Up @@ -179,4 +181,4 @@ uint64 ServerBW::getPMMWrites()
return result;
}

} // namespace pcm
} // namespace pcm
9 changes: 7 additions & 2 deletions src/bw.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
#include <memory>
#include <vector>
#include <array>
#include "mmio.h"
#include <stddef.h>
#include "types.h"

namespace pcm {
class MMIORange;
}

namespace pcm {

Expand Down Expand Up @@ -70,4 +75,4 @@ class ServerBW
uint64 getPMMWrites();
};

} // namespace pcm
} // namespace pcm
8 changes: 2 additions & 6 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
// Copyright (c) 2009-2017, Intel Corporation
// written by Steven Briscoe

#include <cstdlib>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <sstream>
#include <exception>
#include <stdexcept>
#include <grp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>

#include "../daemon/common.h"
#include "client.h"
Expand Down
6 changes: 1 addition & 5 deletions src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
// Copyright (c) 2009-2017, Intel Corporation
// written by Steven Briscoe

#include <sys/types.h>
#include <string>
#include <grp.h>

#include "../daemon/common.h"

#ifndef CLIENT_H_
#define CLIENT_H_

#include "../daemon/common.h"

namespace PCMDaemon {

class Client {
Expand Down
2 changes: 2 additions & 0 deletions src/client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include "daemon/common.h"

#include "client.h"

Expand Down
23 changes: 21 additions & 2 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
#include "winring0/OlsApiInit.h"
#include "windows/windriver.h"
#else
#include <sched.h>
#include <pthread.h>
#include <unistd.h>
#if defined(__FreeBSD__) || (defined(__DragonFly__) && __DragonFly_version >= 400707)
#include <pthread_np.h>
#include <sys/_cpuset.h>
Expand All @@ -58,20 +60,37 @@
#include <sys/mman.h>
#include <dirent.h>
#include <sys/resource.h>
#include <bits/strings_fortified.h>

#ifdef PCM_USE_PERF
#include <linux/perf_event.h>
#include <syscall.h>
#endif

#endif
#endif

#include <string.h>
#include <limits>
#include <map>
#include <algorithm>
#include <thread>
#include <future>
#include <functional>
#include <queue>
#include <condition_variable>
#include <mutex>
#include <atomic>
#include <fcntl.h>
#include <sys/types.h>
#include <cstdlib>
#include <fstream>
#include <initializer_list>
#include <iomanip>
#include <stdexcept>
#include <system_error>
#include "bw.h"
#include "exceptions/unsupported_processor_exception.hpp"
#include "mutex.h"
#include "width_extender.h"

#ifdef __APPLE__
#include <sys/types.h>
Expand Down
47 changes: 21 additions & 26 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,29 @@
#include "topologyentry.h"
#include "msr.h"
#include "pci.h"
#include "bw.h"
#include "width_extender.h"
#include "exceptions/unsupported_processor_exception.hpp"

#include <vector>
#include <array>
#include <limits>
#include <string>
#include <memory>
#include <map>
#include <unordered_map>
#include <string.h>
#include <assert.h>

#include <algorithm>
#include <exception>
#include <iostream>
#include <type_traits>
#include <utility>
#include "mmio.h"
#include "utils.h"
#include "width_extender.h"

#ifdef PCM_USE_PERF
#include <linux/perf_event.h>
#include <errno.h>
#define PCM_PERF_COUNT_HW_REF_CPU_CYCLES (9)
#endif

#ifndef _MSC_VER
#define NOMINMAX
#include <semaphore.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <unistd.h>
#endif

#ifdef _MSC_VER
#if _MSC_VER>= 1600
#include <intrin.h>
Expand All @@ -66,20 +59,24 @@
#include "resctrl.h"
#endif

namespace pcm {
class FreeRunningBWCounters;
class ServerBW;
class SystemCounterState;
class SocketCounterState;
class CoreCounterState;
class ServerUncoreCounterState;
class PCM;
class CoreTaskQueue;
class SystemRoot;
}

namespace pcm {

#ifdef _MSC_VER
void PCM_API restrictDriverAccess(LPCTSTR path);
#endif

class SystemCounterState;
class SocketCounterState;
class CoreCounterState;
class BasicCounterState;
class ServerUncoreCounterState;
class PCM;
class CoreTaskQueue;
class SystemRoot;

/*
CPU performance monitoring routines
Expand Down Expand Up @@ -503,8 +500,6 @@ typedef SimpleCounterState PCIeCounterState;
typedef SimpleCounterState IIOCounterState;
typedef std::vector<uint64> eventGroup_t;

class PerfVirtualControlRegister;

/*!
\brief CPU Performance Monitor
Expand Down
17 changes: 15 additions & 2 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@

#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <time.h>
#include <bits/getopt_core.h>
#include <bits/types/struct_tm.h>
#include <ctype.h>
#include <grp.h>
#include <stdio.h>
#include <memory>
#include <new>
#include <utility>
#include "types.h"
#include "utils.h"

#ifdef __linux__
#include <ext/alloc_traits.h>
#endif

#ifndef CLOCK_MONOTONIC_RAW
#define CLOCK_MONOTONIC_RAW (4) /* needed for SLES11 */
#endif

#include "daemon.h"
#include "common.h"
#include "pcm.h"
#include "exceptions/unsupported_processor_exception.hpp"

namespace PCMDaemon {

Expand Down
6 changes: 4 additions & 2 deletions src/daemon/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
#include <sys/types.h>
#include <map>
#include <string>
#include <grp.h>

#include "common.h"
#include "pcm.h"
#include <vector>
#include "cpucounters.h"

using namespace pcm;

namespace PCMDaemon {

Expand Down
2 changes: 2 additions & 0 deletions src/dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <vector>
#include <memory>
#include <unistd.h>
#include <initializer_list>
#include <mutex>
#include "cpucounters.h"
#include "dashboard.h"

Expand Down
10 changes: 3 additions & 7 deletions src/mmio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@

#include <iostream>
#include <string.h>
#ifndef _MSC_VER
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <exception>
#include <fcntl.h>
#include "pci.h"
#include "mmio.h"

#ifndef _MSC_VER
Expand All @@ -22,10 +18,10 @@
#ifdef _MSC_VER
#include <windows.h>
#include "utils.h"
#else
#include <unistd.h>
#endif

#include <assert.h>

namespace pcm {

#ifdef _MSC_VER
Expand Down
8 changes: 2 additions & 6 deletions src/mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
#include "windows.h"
#include "winpmem\winpmem.h"
#include "Winmsrdriver\msrstruct.h"
#else
#include <unistd.h>
#endif

#include "mutex.h"
#include <memory>
#endif

namespace pcm {

Expand Down Expand Up @@ -152,4 +148,4 @@ class MMIORange
};
#endif

} // namespace pcm
} // namespace pcm
11 changes: 6 additions & 5 deletions src/msr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
// Austen Ott
// Jim Harris (FreeBSD)

#include <sys/types.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include "types.h"
#include "msr.h"
#include "utils.h"
#include <assert.h>

#include <errno.h>
#include <string.h>
#include <exception>
#include <iostream>
#include <string>

#ifdef _MSC_VER

Expand All @@ -30,8 +33,6 @@
#include <sys/cpuctl.h>
#endif

#include <mutex>

namespace pcm {

#ifdef _MSC_VER
Expand Down
1 change: 1 addition & 0 deletions src/msr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "types.h"
#include <stdexcept>

#ifdef _MSC_VER
#include "windows.h"
Expand Down
Loading

0 comments on commit 23108b1

Please sign in to comment.