blob: 55bbda8c48ac44bd04807e47efcb7cae46e38c4a (
plain)
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
|
/* Copyright (c) 2016, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "config.h"
#include <odp_internal.h>
#include <cpu_flags.h>
#include <string.h>
int cpuinfo_parser(FILE *file, system_info_t *sysinfo)
{
char str[1024];
char *pos;
double ghz = 0.0;
uint64_t hz;
int id = 0;
strcpy(sysinfo->cpu_arch_str, "x86");
while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
pos = strstr(str, "model name");
if (pos) {
pos = strchr(str, ':');
strncpy(sysinfo->model_str[id], pos + 2,
sizeof(sysinfo->model_str[id]) - 1);
pos = strchr(sysinfo->model_str[id], '@');
if (pos) {
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", &ghz) == 1) {
hz = (uint64_t)(ghz * 1000000000.0);
sysinfo->cpu_hz_max[id] = hz;
}
}
id++;
}
}
return 0;
}
void sys_info_print_arch(void)
{
cpu_flags_print_all();
}
|