cpuinfo: show cpufreq when hardware perfermance counting enabled

Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
liaoao 2023-08-18 10:33:00 +08:00 committed by Xiang Xiao
parent 45c04e9125
commit c31e869fac
7 changed files with 18 additions and 3 deletions

View File

@ -51,9 +51,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* CPU Features */

View File

@ -72,9 +72,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* CPU Features */

View File

@ -70,9 +70,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* CPU Features */

View File

@ -72,9 +72,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* CPU Features */

View File

@ -74,9 +74,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* Cpu features */

View File

@ -72,9 +72,11 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* CPU Features */

View File

@ -100,14 +100,17 @@ ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off,
"byte order\t: %s\n"
"cpu MHz\t\t: %lu.%02lu\n"
"bogomips\t: %u.%02u\n",
XCHAL_HAVE_BE ? "big" : "little",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100,
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
/* Features */
procfs_sprintf(buf, buf_size, &file_off, "flags\t\t: "