Skip to content

Commit 3403e89

Browse files
zhang-ruilenb
authored andcommitted
tools/power turbostat: Remove add_msr_perf_counter_()
As the only caller of add_msr_perf_counter_(), add_msr_perf_counter() just gives extra debug output on top. There is no need to keep both functions. Remove add_msr_perf_counter_() and move all the logic to add_msr_perf_counter(). No functional change. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 4d6ced7 commit 3403e89

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8052,30 +8052,26 @@ int add_cstate_perf_counter(int cpu, struct cstate_counter_info_t *cci, const st
80528052
return ret;
80538053
}
80548054

8055-
int add_msr_perf_counter_(int cpu, struct msr_counter_info_t *cci, const struct msr_counter_arch_info *cai)
8055+
int add_msr_perf_counter(int cpu, struct msr_counter_info_t *cci, const struct msr_counter_arch_info *cai)
80568056
{
8057+
int ret = -1;
8058+
80578059
if (no_perf)
80588060
return -1;
80598061

80608062
const unsigned int type = read_perf_type(cai->perf_subsys);
80618063
const unsigned int config = read_perf_config(cai->perf_subsys, cai->perf_name);
80628064

8063-
const int fd_counter = open_perf_counter(cpu, type, config, cci->fd_perf, PERF_FORMAT_GROUP);
8065+
ret = open_perf_counter(cpu, type, config, cci->fd_perf, PERF_FORMAT_GROUP);
80648066

8065-
if (fd_counter == -1)
8066-
return -1;
8067+
if (ret == -1)
8068+
goto end;
80678069

80688070
/* If it's the first counter opened, make it a group descriptor */
80698071
if (cci->fd_perf == -1)
8070-
cci->fd_perf = fd_counter;
8071-
8072-
return fd_counter;
8073-
}
8074-
8075-
int add_msr_perf_counter(int cpu, struct msr_counter_info_t *cci, const struct msr_counter_arch_info *cai)
8076-
{
8077-
int ret = add_msr_perf_counter_(cpu, cci, cai);
8072+
cci->fd_perf = ret;
80788073

8074+
end:
80798075
if (debug)
80808076
fprintf(stderr, "%s: %s/%s: %d (cpu: %d)\n", __func__, cai->perf_subsys, cai->perf_name, ret, cpu);
80818077

0 commit comments

Comments
 (0)