Skip to content

Commit be07836

Browse files
committed
Reorganize #include statements
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
1 parent 77742d1 commit be07836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+400
-381
lines changed

src/bw.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
// Patrick Konsor
55
//
66

7-
#include <iostream>
87
#include <exception>
9-
#include "mmio.h"
8+
#include <iostream>
9+
1010
#include "bw.h"
11+
#include "mmio.h"
1112
#include "pci.h"
1213
#include "utils.h"
1314

src/bw.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
1111
*/
1212

13-
#include <memory>
14-
#include <vector>
1513
#include <array>
14+
#include <memory>
1615
#include <stddef.h>
16+
#include <vector>
17+
1718
#include "types.h"
1819

1920
namespace pcm {

src/client/client.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Copyright (c) 2009-2017, Intel Corporation
33
// written by Steven Briscoe
44

5-
#include <iostream>
6-
#include <unistd.h>
7-
#include <sys/shm.h>
85
#include <errno.h>
6+
#include <iostream>
7+
#include <sstream>
98
#include <stdexcept>
109
#include <stdio.h>
1110
#include <stdlib.h>
1211
#include <string.h>
13-
#include <sstream>
12+
#include <sys/shm.h>
13+
#include <unistd.h>
1414

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

src/client/client.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// written by Steven Briscoe
44

55
#include <string>
6+
67
#include "../daemon/common.h"
78

89
#ifndef CLIENT_H_

src/client/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
//Test program for PCM Daemon client
66

7-
#include <iostream>
8-
#include <iomanip>
97
#include <cstdlib>
8+
#include <iomanip>
9+
#include <iostream>
1010
#include <string>
11-
#include "daemon/common.h"
1211

12+
#include "daemon/common.h"
1313
#include "client.h"
1414

1515
void printTitle(std::string title)

src/cpucounters.cpp

+58-48
Original file line numberDiff line numberDiff line change
@@ -13,89 +13,99 @@
1313

1414
//#define PCM_TEST_FALLBACK_TO_ATOM
1515

16-
#include <stdio.h>
17-
#include <assert.h>
1816
#ifdef PCM_EXPORTS
19-
// pcm-lib.h includes cpucounters.h
2017
#include "windows\pcm-lib.h"
21-
#else
22-
#include "cpucounters.h"
2318
#endif
19+
20+
#include "bw.h"
21+
#include "cpucounters.h"
22+
#include "exceptions/unsupported_processor_exception.hpp"
2423
#include "msr.h"
24+
#include "mutex.h"
2525
#include "pci.h"
26+
#include "topology.h"
2627
#include "types.h"
2728
#include "utils.h"
28-
#include "topology.h"
29+
#include "width_extender.h"
2930

30-
#if defined (__FreeBSD__) || defined(__DragonFly__)
31-
#include <sys/param.h>
32-
#include <sys/module.h>
31+
#include <algorithm>
32+
#include <assert.h>
33+
#include <atomic>
34+
#include <condition_variable>
35+
#include <cstdlib>
36+
#include <fcntl.h>
37+
#include <fstream>
38+
#include <future>
39+
#include <initializer_list>
40+
#include <iomanip>
41+
#include <map>
42+
#include <mutex>
43+
#include <queue>
44+
#include <stdexcept>
45+
#include <stdio.h>
46+
#include <string.h>
47+
#include <system_error>
3348
#include <sys/types.h>
34-
#include <sys/sysctl.h>
35-
#include <sys/sem.h>
36-
#include <sys/ioccom.h>
37-
#include <sys/cpuctl.h>
38-
#include <machine/cpufunc.h>
39-
#endif
49+
#include <thread>
4050

4151
#ifdef _MSC_VER
42-
#include <intrin.h>
43-
#include <windows.h>
52+
4453
#include <comdef.h>
54+
#include <intrin.h>
4555
#include <tchar.h>
46-
#include "winring0/OlsApiInit.h"
56+
#include <windows.h>
4757
#include "windows/windriver.h"
58+
#include "winring0/OlsApiInit.h"
59+
4860
#else
61+
4962
#include <sched.h>
5063
#include <pthread.h>
5164
#include <unistd.h>
52-
#if defined(__FreeBSD__) || (defined(__DragonFly__) && __DragonFly_version >= 400707)
53-
#include <pthread_np.h>
54-
#include <sys/_cpuset.h>
55-
#include <sys/cpuset.h>
56-
#endif
65+
5766
#include <errno.h>
5867
#include <sys/time.h>
68+
69+
#endif
70+
5971
#ifdef __linux__
72+
6073
#include <sys/mman.h>
6174
#include <dirent.h>
6275
#include <sys/resource.h>
6376
#include <bits/strings_fortified.h>
6477

78+
#endif
79+
6580
#ifdef PCM_USE_PERF
81+
6682
#include <linux/perf_event.h>
6783
#include <syscall.h>
68-
#endif
6984

7085
#endif
71-
#endif
72-
73-
#include <string.h>
74-
#include <map>
75-
#include <algorithm>
76-
#include <thread>
77-
#include <future>
78-
#include <queue>
79-
#include <condition_variable>
80-
#include <mutex>
81-
#include <atomic>
82-
#include <fcntl.h>
83-
#include <sys/types.h>
84-
#include <cstdlib>
85-
#include <fstream>
86-
#include <initializer_list>
87-
#include <iomanip>
88-
#include <stdexcept>
89-
#include <system_error>
90-
#include "bw.h"
91-
#include "exceptions/unsupported_processor_exception.hpp"
92-
#include "mutex.h"
93-
#include "width_extender.h"
9486

9587
#ifdef __APPLE__
96-
#include <sys/types.h>
88+
89+
#include <sys/sem.h>
9790
#include <sys/sysctl.h>
91+
#include <sys/types.h>
92+
93+
#endif
94+
95+
#if defined (__FreeBSD__) || defined(__DragonFly__)
96+
97+
#include <machine/cpufunc.h>
98+
#include <pthread_np.h>
99+
#include <sys/_cpuset.h>
100+
#include <sys/cpuctl.h>
101+
#include <sys/cpuset.h>
102+
#include <sys/ioccom.h>
103+
#include <sys/module.h>
104+
#include <sys/param.h>
98105
#include <sys/sem.h>
106+
#include <sys/sysctl.h>
107+
#include <sys/types.h>
108+
99109
#endif
100110

101111
namespace pcm {

src/cpucounters.h

+10-16
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,36 @@
2222
#undef PCM_DEBUG_TOPOLOGY // debug of topology enumeration routine
2323
#undef PCM_UNCORE_PMON_BOX_CHECK_STATUS // debug only
2424

25-
#include "types.h"
26-
#include "topologyentry.h"
2725
#include "msr.h"
2826
#include "pci.h"
27+
#include "types.h"
28+
#include "topologyentry.h"
2929

30-
#include <vector>
30+
#include <algorithm>
3131
#include <array>
32-
#include <string>
33-
#include <memory>
34-
#include <map>
35-
#include <unordered_map>
36-
#include <string.h>
3732
#include <assert.h>
38-
39-
#include <algorithm>
4033
#include <exception>
4134
#include <iostream>
35+
#include <map>
36+
#include <memory>
37+
#include <unordered_map>
38+
#include <string>
39+
#include <string.h>
4240
#include <type_traits>
4341
#include <utility>
42+
#include <vector>
43+
4444
#include "mmio.h"
4545
#include "utils.h"
4646
#include "width_extender.h"
4747

48-
#ifdef PCM_USE_PERF
4948
#define PCM_PERF_COUNT_HW_REF_CPU_CYCLES (9)
50-
#endif
5149

5250
#ifdef _MSC_VER
53-
#if _MSC_VER>= 1600
5451
#include <intrin.h>
5552
#endif
56-
#endif
5753

58-
#ifdef __linux__
5954
#include "resctrl.h"
60-
#endif
6155

6256
namespace pcm {
6357
class FreeRunningBWCounters;

src/daemon/common.h

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef COMMON_H_
66
#define COMMON_H_
77

8+
#include <algorithm>
89
#include <cstring>
910
#include <stdint.h>
1011

src/daemon/daemon.cpp

+15-19
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,34 @@
22
// Copyright (c) 2009-2018,2022 Intel Corporation
33
// written by Steven Briscoe
44

5-
#include <cstdlib>
6-
#include <iostream>
5+
#include "common.h"
6+
#include "daemon.h"
7+
#include "exceptions/unsupported_processor_exception.hpp"
8+
#include "types.h"
9+
#include "utils.h"
10+
711
#include <algorithm>
8-
#include <unistd.h>
9-
#include <sys/types.h>
10-
#include <sys/ipc.h>
11-
#include <sys/shm.h>
12-
#include <errno.h>
13-
#include <time.h>
1412
#include <bits/getopt_core.h>
1513
#include <bits/types/struct_tm.h>
14+
#include <cstdlib>
1615
#include <ctype.h>
16+
#include <errno.h>
1717
#include <grp.h>
18-
#include <stdio.h>
18+
#include <iostream>
1919
#include <memory>
2020
#include <new>
21+
#include <stdio.h>
22+
#include <sys/ipc.h>
23+
#include <sys/shm.h>
24+
#include <sys/types.h>
25+
#include <time.h>
26+
#include <unistd.h>
2127
#include <utility>
22-
#include "types.h"
23-
#include "utils.h"
2428

2529
#ifdef __linux__
2630
#include <ext/alloc_traits.h>
2731
#endif
2832

29-
#ifndef CLOCK_MONOTONIC_RAW
30-
#define CLOCK_MONOTONIC_RAW (4) /* needed for SLES11 */
31-
#endif
32-
33-
#include "daemon.h"
34-
#include "common.h"
35-
#include "exceptions/unsupported_processor_exception.hpp"
36-
3733
namespace PCMDaemon {
3834

3935
std::string Daemon::shmIdLocation_;

src/daemon/daemon.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#ifndef DAEMON_H_
66
#define DAEMON_H_
77

8+
#include "common.h"
9+
#include "cpucounters.h"
10+
11+
#include <string>
812
#include <sys/types.h>
913
#include <map>
10-
#include <string>
11-
12-
#include "common.h"
1314
#include <vector>
14-
#include "cpucounters.h"
1515

1616
using namespace pcm;
1717

src/dashboard.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// SPDX-License-Identifier: BSD-3-Clause
22
// Copyright (c) 2020, Intel Corporation
33

4-
#include <vector>
5-
#include <memory>
6-
#include <unistd.h>
7-
#include <initializer_list>
8-
#include <mutex>
94
#include "cpucounters.h"
105
#include "dashboard.h"
116

7+
#include <initializer_list>
8+
#include <memory>
9+
#include <mutex>
10+
#include <unistd.h>
11+
#include <vector>
12+
1213
namespace pcm {
1314

1415
class Target

0 commit comments

Comments
 (0)