Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include-what-you-use changes and #include section reorganization #452

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 4 additions & 1 deletion src/bw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
// Patrick Konsor
//

#include <exception>
#include <iostream>

#include "bw.h"
#include "mmio.h"
#include "pci.h"
#include "utils.h"

Expand Down Expand Up @@ -179,4 +182,4 @@ uint64 ServerBW::getPMMWrites()
return result;
}

} // namespace pcm
} // namespace pcm
12 changes: 9 additions & 3 deletions src/bw.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@

*/

#include <array>
#include <memory>
#include <stddef.h>
#include <vector>
#include <array>
#include "mmio.h"

#include "types.h"

namespace pcm {
class MMIORange;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop these lines "} namespace pcm {"


namespace pcm {
Comment on lines +22 to 24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines can be deleted


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

} // namespace pcm
} // namespace pcm
12 changes: 4 additions & 8 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 <iostream>
#include <sstream>
#include <exception>
#include <stdexcept>
#include <grp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/shm.h>
#include <unistd.h>

#include "../daemon/common.h"
#include "client.h"
Expand Down
5 changes: 1 addition & 4 deletions src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
// 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
6 changes: 4 additions & 2 deletions src/client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

//Test program for PCM Daemon client

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>

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

void printTitle(std::string title)
Expand Down
101 changes: 65 additions & 36 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,70 +13,99 @@

//#define PCM_TEST_FALLBACK_TO_ATOM

#include <stdio.h>
#include <assert.h>
#ifdef PCM_EXPORTS
// pcm-lib.h includes cpucounters.h
#include "windows\pcm-lib.h"
#else
#include "cpucounters.h"
#endif

#include "bw.h"
#include "cpucounters.h"
#include "exceptions/unsupported_processor_exception.hpp"
#include "msr.h"
#include "mutex.h"
#include "pci.h"
#include "topology.h"
#include "types.h"
#include "utils.h"
#include "topology.h"
#include "width_extender.h"

#if defined (__FreeBSD__) || defined(__DragonFly__)
#include <sys/param.h>
#include <sys/module.h>
#include <algorithm>
#include <assert.h>
#include <atomic>
#include <condition_variable>
#include <cstdlib>
#include <fcntl.h>
#include <fstream>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <map>
#include <mutex>
#include <queue>
#include <stdexcept>
#include <stdio.h>
#include <string.h>
#include <system_error>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/sem.h>
#include <sys/ioccom.h>
#include <sys/cpuctl.h>
#include <machine/cpufunc.h>
#endif
#include <thread>

#ifdef _MSC_VER
#include <intrin.h>
#include <windows.h>

#include <comdef.h>
#include <intrin.h>
#include <tchar.h>
#include "winring0/OlsApiInit.h"
#include <windows.h>
#include "windows/windriver.h"
#include "winring0/OlsApiInit.h"

#else

#include <sched.h>
#include <pthread.h>
#if defined(__FreeBSD__) || (defined(__DragonFly__) && __DragonFly_version >= 400707)
#include <pthread_np.h>
#include <sys/_cpuset.h>
#include <sys/cpuset.h>
#endif
#include <unistd.h>

#include <errno.h>
#include <sys/time.h>

#endif

#ifdef __linux__

#include <sys/mman.h>
#include <dirent.h>
#include <sys/resource.h>
#endif
#include <bits/strings_fortified.h>

#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>
#ifdef PCM_USE_PERF

#include <linux/perf_event.h>
#include <syscall.h>

#endif

#ifdef __APPLE__
#include <sys/types.h>

#include <sys/sem.h>
#include <sys/sysctl.h>
#include <sys/types.h>

#endif

#if defined (__FreeBSD__) || defined(__DragonFly__)

#include <machine/cpufunc.h>
#include <pthread_np.h>
#include <sys/_cpuset.h>
#include <sys/cpuctl.h>
#include <sys/cpuset.h>
#include <sys/ioccom.h>
#include <sys/module.h>
#include <sys/param.h>
#include <sys/sem.h>
#include <sys/sysctl.h>
#include <sys/types.h>

#endif

namespace pcm {
Expand Down
65 changes: 27 additions & 38 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,64 +22,55 @@
#undef PCM_DEBUG_TOPOLOGY // debug of topology enumeration routine
#undef PCM_UNCORE_PMON_BOX_CHECK_STATUS // debug only

#include "types.h"
#include "topologyentry.h"
#include "msr.h"
#include "pci.h"
#include "bw.h"
#include "width_extender.h"
#include "exceptions/unsupported_processor_exception.hpp"
#include "types.h"
#include "topologyentry.h"

#include <vector>
#include <algorithm>
#include <array>
#include <limits>
#include <string>
#include <memory>
#include <assert.h>
#include <exception>
#include <iostream>
#include <map>
#include <memory>
#include <unordered_map>
#include <string>
#include <string.h>
#include <assert.h>
#include <type_traits>
#include <utility>
#include <vector>

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

#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
#define PCM_PERF_COUNT_HW_REF_CPU_CYCLES (9)

#ifdef _MSC_VER
#if _MSC_VER>= 1600
#include <intrin.h>
#endif
#endif

#ifdef __linux__
#include "resctrl.h"
#endif

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop these lines "} namespace pcm {"


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 +494,6 @@ typedef SimpleCounterState PCIeCounterState;
typedef SimpleCounterState IIOCounterState;
typedef std::vector<uint64> eventGroup_t;

class PerfVirtualControlRegister;

/*!
\brief CPU Performance Monitor

Expand Down
1 change: 1 addition & 0 deletions src/daemon/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef COMMON_H_
#define COMMON_H_

#include <algorithm>
#include <cstring>
#include <stdint.h>

Expand Down
Loading