diff options
author | Marat Dukhan <maratek@gmail.com> | 2017-09-29 07:00:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 07:00:29 +0300 |
commit | ca67e696a5164ea6fe77c7510c55665197e64915 (patch) | |
tree | 5b12147a514f62df96ca631f0c192893900fb7b4 /README.md | |
parent | b92e2edafb0684886976d32a7bcbc25d8f5a6eec (diff) | |
download | cpuinfo-ca67e696a5164ea6fe77c7510c55665197e64915.tar.gz |
Improve examples in README
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -31,8 +31,13 @@ if (cpuinfo_has_x86_avx) { Check if the thread runs on a Cortex-A53 core ```c cpuinfo_initialize(); -if (cpuinfo_get_current_core()->uarch == cpuinfo_uarch_cortex_a53) { - cortex_a53_implementation(arguments); +switch (cpuinfo_get_current_core()->uarch) { + case cpuinfo_uarch_cortex_a53: + cortex_a53_implementation(arguments); + break; + default: + generic_implementation(arguments); + break; } ``` @@ -49,7 +54,7 @@ cpu_set_t cpu_set; CPU_ZERO(&cpu_set); const struct cpuinfo_cache* current_l2 = cpuinfo_get_current_processor()->l2; for (uint32_t i = 0; i < current_l2->processor_count; i++) { - CPU_SET(cpuinfo_processors[current_l2->processor_start + i].linux_id, &cpu_set); + CPU_SET(cpuinfo_get_processor(current_l2->processor_start + i).linux_id, &cpu_set); } pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpu_set); ``` |