turbostat.c (fb5e29df8d15a131a02a4e04bbd9df8450eecc7d) turbostat.c (033312336d67a2ca9b5ff4ad35e5dfd99042d2a3)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * turbostat -- show CPU frequency and C-state residency
4 * on modern Intel and AMD processors.
5 *
6 * Copyright (c) 2022 Intel Corporation.
7 * Len Brown <len.brown@intel.com>
8 */

--- 6118 unchanged lines hidden (view full) ---

6127 return status;
6128}
6129
6130void print_version()
6131{
6132 fprintf(outf, "turbostat version 2022.04.16 - Len Brown <lenb@kernel.org>\n");
6133}
6134
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * turbostat -- show CPU frequency and C-state residency
4 * on modern Intel and AMD processors.
5 *
6 * Copyright (c) 2022 Intel Corporation.
7 * Len Brown <len.brown@intel.com>
8 */

--- 6118 unchanged lines hidden (view full) ---

6127 return status;
6128}
6129
6130void print_version()
6131{
6132 fprintf(outf, "turbostat version 2022.04.16 - Len Brown <lenb@kernel.org>\n");
6133}
6134
6135#define COMMAND_LINE_SIZE 2048
6136
6137void print_bootcmd(void)
6138{
6139 char bootcmd[COMMAND_LINE_SIZE];
6140 FILE *fp;
6141 int ret;
6142
6143 memset(bootcmd, 0, COMMAND_LINE_SIZE);
6144 fp = fopen("/proc/cmdline", "r");
6145 if (!fp)
6146 return;
6147
6148 ret = fread(bootcmd, sizeof(char), COMMAND_LINE_SIZE - 1, fp);
6149 if (ret) {
6150 bootcmd[ret] = '\0';
6151 /* the last character is already '\n' */
6152 fprintf(outf, "Kernel command line: %s", bootcmd);
6153 }
6154
6155 fclose(fp);
6156}
6157
6135int add_counter(unsigned int msr_num, char *path, char *name,
6136 unsigned int width, enum counter_scope scope,
6137 enum counter_type type, enum counter_format format, int flags)
6138{
6139 struct msr_counter *msrp;
6140
6141 msrp = calloc(1, sizeof(struct msr_counter));
6142 if (msrp == NULL) {

--- 455 unchanged lines hidden (view full) ---

6598 }
6599}
6600
6601int main(int argc, char **argv)
6602{
6603 outf = stderr;
6604 cmdline(argc, argv);
6605
6158int add_counter(unsigned int msr_num, char *path, char *name,
6159 unsigned int width, enum counter_scope scope,
6160 enum counter_type type, enum counter_format format, int flags)
6161{
6162 struct msr_counter *msrp;
6163
6164 msrp = calloc(1, sizeof(struct msr_counter));
6165 if (msrp == NULL) {

--- 455 unchanged lines hidden (view full) ---

6621 }
6622}
6623
6624int main(int argc, char **argv)
6625{
6626 outf = stderr;
6627 cmdline(argc, argv);
6628
6606 if (!quiet)
6629 if (!quiet) {
6607 print_version();
6630 print_version();
6631 print_bootcmd();
6632 }
6608
6609 probe_sysfs();
6610
6611 turbostat_init();
6612
6613 msr_sum_record();
6614
6615 /* dump counters and exit */

--- 20 unchanged lines hidden ---
6633
6634 probe_sysfs();
6635
6636 turbostat_init();
6637
6638 msr_sum_record();
6639
6640 /* dump counters and exit */

--- 20 unchanged lines hidden ---