Skip to content

Commit e84ab69

Browse files
Add technology_node field to struct cpu_id_t
1 parent aeb788c commit e84ab69

File tree

247 files changed

+1279
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+1279
-1003
lines changed

cpuid_tool/cpuid_tool.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ typedef enum {
100100
NEED_L3_INSTANCES,
101101
NEED_L4_INSTANCES,
102102
NEED_CODENAME,
103+
NEED_TECHNOLOGY,
103104
NEED_FEATURES,
104105
NEED_CLOCK,
105106
NEED_CLOCK_OS,
@@ -174,6 +175,7 @@ matchtable[] = {
174175
{ NEED_L3_INSTANCES , "--l3-instances" , 1},
175176
{ NEED_L4_INSTANCES , "--l4-instances" , 1},
176177
{ NEED_CODENAME , "--codename" , 1},
178+
{ NEED_TECHNOLOGY , "--technology" , 1},
177179
{ NEED_FEATURES , "--flags" , 1},
178180
{ NEED_CLOCK , "--clock" , 0},
179181
{ NEED_CLOCK_OS , "--clock-os" , 0},
@@ -507,6 +509,9 @@ static void print_info(output_data_switch query, struct cpu_id_t* data)
507509
case NEED_CODENAME:
508510
fprintf(fout, "%s\n", data->cpu_codename);
509511
break;
512+
case NEED_TECHNOLOGY:
513+
fprintf(fout, "%s\n", data->technology_node);
514+
break;
510515
case NEED_FEATURES:
511516
{
512517
for (i = 0; i < NUM_CPU_FEATURES; i++)
@@ -828,6 +833,7 @@ int main(int argc, char** argv)
828833
fprintf(fout, " SSE units : %d bits (%s)\n", data.cpu_types[cpu_type_index].x86.sse_size, data.cpu_types[cpu_type_index].detection_hints[CPU_HINT_SSE_SIZE_AUTH] ? "authoritative" : "non-authoritative");
829834
}
830835
fprintf(fout, " code name : `%s'\n", data.cpu_types[cpu_type_index].cpu_codename);
836+
fprintf(fout, " technology : `%s'\n", data.cpu_types[cpu_type_index].technology_node);
831837
fprintf(fout, " features :");
832838
/*
833839
* Here we enumerate all CPU feature bits, and when a feature

libcpuid/libcpuid.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,9 @@ struct cpu_id_t {
755755

756756
/** processor type purpose, relevant in case of hybrid CPU (e.g. PURPOSE_PERFORMANCE) */
757757
cpu_purpose_t purpose;
758+
759+
/** contains the technology node string, e.g. "32 nm" */
760+
char technology_node[TECHNOLOGY_STR_MAX];
758761
};
759762

760763
/**

libcpuid/libcpuid_constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#define VENDOR_STR_MAX 16
3636
#define BRAND_STR_MAX 64
3737
#define CODENAME_STR_MAX 64
38+
#define TECHNOLOGY_STR_MAX 16
3839
#define CPU_FLAGS_MAX 384
3940
#define MAX_CPUID_LEVEL 32
4041
#define MAX_EXT_CPUID_LEVEL 32
@@ -60,6 +61,7 @@
6061
#define SGX_FLAGS_MAX 14
6162
#define ADDRESS_EXT_CPUID_START 0x80000000
6263
#define ADDRESS_EXT_CPUID_END ADDRESS_EXT_CPUID_START + MAX_EXT_CPUID_LEVEL
64+
#define UNKN_STR "unknown"
6365

6466
typedef enum {
6567
EAX,

libcpuid/libcpuid_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ int match_cpu_codename(const struct match_entry_t* matchtable, int count, struct
136136
bestindex = i;
137137
}
138138
}
139-
strncpy(data->cpu_codename, matchtable[bestindex].name, CODENAME_STR_MAX);
139+
strncpy(data->cpu_codename, matchtable[bestindex].name, CODENAME_STR_MAX);
140+
strncpy(data->technology_node, matchtable[bestindex].technology, TECHNOLOGY_STR_MAX);
140141
return bestscore;
141142
}
142143

libcpuid/libcpuid_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct match_entry_t {
4848
int score;
4949
} brand;
5050
char name[CODENAME_STR_MAX];
51+
char technology[TECHNOLOGY_STR_MAX];
5152
};
5253

5354
// returns the match score:

libcpuid/recog_amd.c

Lines changed: 291 additions & 290 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)