File: 0001-Fix-issue-17-reported-with-gcc-10.patch

package info (click to toggle)
psst 1.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 240 kB
  • sloc: ansic: 1,704; makefile: 46
file content (106 lines) | stat: -rw-r--r-- 3,016 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From 9099338080bacb6caa7b2280773f57d5eef9cc23 Mon Sep 17 00:00:00 2001
From: Noor Mubeen <noor.u.mubeen@intel.com>
Date: Fri, 17 Apr 2020 22:33:09 +0530
Subject: [PATCH] Fix issue#17 reported with gcc-10
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

few globals were redefined accidentally. cleaned them.

Signed-off-by: Noor Mubeen <noor.u.mubeen@intel.com>
---
 src/logger.c | 6 +++---
 src/logger.h | 2 ++
 src/psst.c   | 7 ++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/logger.c b/src/logger.c
index 6285b75..313a64a 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -616,7 +616,7 @@ void do_logging(float *duty_cycle)
 			break;
 
 		case PKG1_POWER_RAPL:
-			pkg_num = i - PKG1_POWER_RAPL;
+			pkg_num = i - PKG0_POWER_RAPL;
 			if (first_log)
 				soc_initial_energy[pkg_num] = atoll(buf);
 
@@ -626,7 +626,7 @@ void do_logging(float *duty_cycle)
 						configpv.poll_period;
 			break;
 		case PKG2_POWER_RAPL:
-			pkg_num = i - PKG2_POWER_RAPL;
+			pkg_num = i - PKG0_POWER_RAPL;
 			if (first_log)
 				soc_initial_energy[pkg_num] = atoll(buf);
 
@@ -636,7 +636,7 @@ void do_logging(float *duty_cycle)
 						configpv.poll_period;
 			break;
 		case PKG3_POWER_RAPL:
-			pkg_num = i - PKG3_POWER_RAPL;
+			pkg_num = i - PKG0_POWER_RAPL;
 			if (first_log)
 				soc_initial_energy[pkg_num] = atoll(buf);
 
diff --git a/src/logger.h b/src/logger.h
index 38033a2..a23ccbd 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -63,6 +63,8 @@ struct log_col_desc {
 	float value;
 };
 
+extern uint64_t pp0_diff_uj, soc_diff_uj[4];
+extern int exit_cpu_thread, exit_io_thread;
 extern int rapl_pp0_supported;
 extern int need_maxed_cpu;
 extern int plog_poll_sec, plog_poll_nsec, duration_sec, duration_nsec;
diff --git a/src/psst.c b/src/psst.c
index 3881276..8ad5b61 100644
--- a/src/psst.c
+++ b/src/psst.c
@@ -44,7 +44,6 @@ void print_version(void)
 	printf("psst version %s\n", VERSION);
 }
 
-int exit_cpu_thread, exit_io_thread;
 static int nr_threads;
 
 /*
@@ -228,7 +227,6 @@ int power_shaping(ps_t *ps, float *v_unit)
 
 #define START_DELAY 0
 
-uint64_t pp0_diff_uj, soc_diff_uj;
 static void work_fn(void *data)
 {
 	int i = 0;
@@ -361,12 +359,12 @@ static void work_fn(void *data)
 		printf("\nDuration: %d ms. poll: %d ms. samples: %d\n",
 					    time_ms, configpv.poll_period, N);
 		if (rapl_pp0_supported) {
-			soc_r_avg = (float)(soc_diff_uj)/(time_ms*1000);
+			soc_r_avg = (float)(soc_diff_uj[0])/(time_ms*1000);
 			pp0_r_avg = (float)(pp0_diff_uj)/(time_ms*1000);
 			printf("Applicable to SOC\n");
 			printf("\tAvg soc power: %.3f W\n", soc_r_avg);
 			printf("\tEnergy consumed (soc): %.3f mJ\n",
-						 (float)soc_diff_uj/1000);
+						 (float)soc_diff_uj[0]/1000);
 			printf("Applicable to CPU\n");
 
 			printf("\tAvg cpu power: %.3f W\n", pp0_r_avg);
@@ -396,7 +394,6 @@ static void psst_signal_handler(int sig)
 }
 
 int dev_msr_fd[MAX_CPU_REPORTS];
-int dev_msr_supported;
 
 int main(int argc, char *argv[])
 {
-- 
2.25.1