Skip to content

Commit

Permalink
Reorganize #include statements
Browse files Browse the repository at this point in the history
This commit applies a few cleanups to the #include sections:

- Remove old version checks for Visual Studio, SUSE Linux, and DragonFly BSD
- Alphabetize the includes
- Consolidate multiple MSC_VER checks in the same file
  • Loading branch information
nealsid committed Sep 30, 2022
1 parent c154d45 commit 27e8163
Show file tree
Hide file tree
Showing 42 changed files with 400 additions and 381 deletions.
5 changes: 3 additions & 2 deletions src/bw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
// Patrick Konsor
//

#include <iostream>
#include <exception>
#include "mmio.h"
#include <iostream>

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

Expand Down
5 changes: 3 additions & 2 deletions src/bw.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
*/

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

#include "types.h"

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

#include <iostream>
#include <unistd.h>
#include <sys/shm.h>
#include <errno.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <sys/shm.h>
#include <unistd.h>

#include "../daemon/common.h"
#include "client.h"
Expand Down
1 change: 1 addition & 0 deletions src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// written by Steven Briscoe

#include <string>

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

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

void printTitle(std::string title)
Expand Down
106 changes: 58 additions & 48 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,89 +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>
#include <unistd.h>
#if defined(__FreeBSD__) || (defined(__DragonFly__) && __DragonFly_version >= 400707)
#include <pthread_np.h>
#include <sys/_cpuset.h>
#include <sys/cpuset.h>
#endif

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

#endif

#ifdef __linux__

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

#endif

#ifdef PCM_USE_PERF

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

#endif
#endif

#include <string.h>
#include <map>
#include <algorithm>
#include <thread>
#include <future>
#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>

#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
26 changes: 10 additions & 16 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,36 @@
#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 "types.h"
#include "topologyentry.h"

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

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

#include "mmio.h"
#include "utils.h"
#include "width_extender.h"

#ifdef PCM_USE_PERF
#define PCM_PERF_COUNT_HW_REF_CPU_CYCLES (9)
#endif

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

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

namespace pcm {
class FreeRunningBWCounters;
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
34 changes: 15 additions & 19 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,34 @@
// Copyright (c) 2009-2018,2022 Intel Corporation
// written by Steven Briscoe

#include <cstdlib>
#include <iostream>
#include "common.h"
#include "daemon.h"
#include "exceptions/unsupported_processor_exception.hpp"
#include "types.h"
#include "utils.h"

#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 <cstdlib>
#include <ctype.h>
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <iostream>
#include <memory>
#include <new>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#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 "exceptions/unsupported_processor_exception.hpp"

namespace PCMDaemon {

std::string Daemon::shmIdLocation_;
Expand Down
8 changes: 4 additions & 4 deletions src/daemon/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#ifndef DAEMON_H_
#define DAEMON_H_

#include "common.h"
#include "cpucounters.h"

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

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

using namespace pcm;

Expand Down
11 changes: 6 additions & 5 deletions src/dashboard.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020, Intel Corporation

#include <vector>
#include <memory>
#include <unistd.h>
#include <initializer_list>
#include <mutex>
#include "cpucounters.h"
#include "dashboard.h"

#include <initializer_list>
#include <memory>
#include <mutex>
#include <unistd.h>
#include <vector>

namespace pcm {

class Target
Expand Down
Loading

0 comments on commit 27e8163

Please sign in to comment.