mirror of
https://github.com/anrieff/libcpuid
synced 2024-11-10 22:59:13 +00:00
Documented the cpu listing functions better, tidy up cpuid_tool help
git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@46 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
parent
5ae4a8dd8e
commit
9f61c6c8e9
3 changed files with 24 additions and 22 deletions
|
@ -143,17 +143,17 @@ static void usage(void)
|
||||||
int line_fill, l, i;
|
int line_fill, l, i;
|
||||||
printf("Usage: cpuid_tool [options]\n\n");
|
printf("Usage: cpuid_tool [options]\n\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" -h,--help - Show this help\n");
|
printf(" -h, --help - Show this help\n");
|
||||||
printf(" --load=<file> - Load RAW CPUID data from file\n");
|
printf(" --load=<file> - Load raw CPUID data from file\n");
|
||||||
printf(" --save=<file> - Aquire RAW CPUID data and write it to file\n");
|
printf(" --save=<file> - Aquire raw CPUID data and write it to file\n");
|
||||||
printf(" --report,--all - Report all decoded CPU info (w/o clock)\n");
|
printf(" --report, --all - Report all decoded CPU info (w/o clock)\n");
|
||||||
printf(" --clock - in conjunction to --report: print CPU clock as well\n");
|
printf(" --clock - in conjunction to --report: print CPU clock as well\n");
|
||||||
printf(" --clock-rdtsc - same as --clock, but use RDTSC for clock detection\n");
|
printf(" --clock-rdtsc - same as --clock, but use RDTSC for clock detection\n");
|
||||||
printf(" --quiet - disable warnings\n");
|
printf(" --cpulist - list all known CPUs\n");
|
||||||
|
printf(" --quiet - disable warnings\n");
|
||||||
printf(" --outfile=<file> - redirect all output to this file, instead of stdout\n");
|
printf(" --outfile=<file> - redirect all output to this file, instead of stdout\n");
|
||||||
printf(" --verbose, -v - be extra verbose (more keys increase verbosiness level)\n");
|
printf(" --verbose, -v - be extra verbose (more keys increase verbosiness level)\n");
|
||||||
printf(" --version - print library version\n");
|
printf(" --version - print library version\n");
|
||||||
printf(" --cpulist - list all known CPUs\n");
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Query switches (generate 1 line of ouput per switch; in order of appearance):");
|
printf("Query switches (generate 1 line of ouput per switch; in order of appearance):");
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ static void print_info(output_data_switch query, struct cpu_raw_data_t* raw,
|
||||||
fprintf(fout, "%d\n", data->num_logical_cpus);
|
fprintf(fout, "%d\n", data->num_logical_cpus);
|
||||||
break;
|
break;
|
||||||
case NEED_TOTAL_CPUS:
|
case NEED_TOTAL_CPUS:
|
||||||
fprintf(fout, "%d\n", data->total_cpus);
|
fprintf(fout, "%d\n", data->total_logical_cpus);
|
||||||
break;
|
break;
|
||||||
case NEED_L1D_SIZE:
|
case NEED_L1D_SIZE:
|
||||||
fprintf(fout, "%d\n", data->l1_data_cache);
|
fprintf(fout, "%d\n", data->l1_data_cache);
|
||||||
|
@ -548,7 +548,7 @@ int main(int argc, char** argv)
|
||||||
fprintf(fout, " ext_model : %d (%02Xh)\n", data.ext_model, data.ext_model);
|
fprintf(fout, " ext_model : %d (%02Xh)\n", data.ext_model, data.ext_model);
|
||||||
fprintf(fout, " num_cores : %d\n", data.num_cores);
|
fprintf(fout, " num_cores : %d\n", data.num_cores);
|
||||||
fprintf(fout, " num_logical: %d\n", data.num_logical_cpus);
|
fprintf(fout, " num_logical: %d\n", data.num_logical_cpus);
|
||||||
fprintf(fout, " total_cpus : %d\n", data.total_cpus);
|
fprintf(fout, " tot_logical: %d\n", data.total_logical_cpus);
|
||||||
fprintf(fout, " L1 D cache : %d KB\n", data.l1_data_cache);
|
fprintf(fout, " L1 D cache : %d KB\n", data.l1_data_cache);
|
||||||
fprintf(fout, " L1 I cache : %d KB\n", data.l1_instruction_cache);
|
fprintf(fout, " L1 I cache : %d KB\n", data.l1_instruction_cache);
|
||||||
fprintf(fout, " L2 cache : %d KB\n", data.l2_cache);
|
fprintf(fout, " L2 cache : %d KB\n", data.l2_cache);
|
||||||
|
|
|
@ -250,7 +250,7 @@ static int cpuid_basic_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
|
||||||
data->brand_str[48] = 0;
|
data->brand_str[48] = 0;
|
||||||
}
|
}
|
||||||
load_features_common(raw, data);
|
load_features_common(raw, data);
|
||||||
data->total_cpus = get_total_cpus();
|
data->total_logical_cpus = get_total_cpus();
|
||||||
return set_error(ERR_OK);
|
return set_error(ERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ struct cpu_id_t {
|
||||||
* If you're writing a multithreaded program and you want to run it on
|
* If you're writing a multithreaded program and you want to run it on
|
||||||
* all CPUs, this is the number of threads you need.
|
* all CPUs, this is the number of threads you need.
|
||||||
*/
|
*/
|
||||||
int32_t total_cpus;
|
int32_t total_logical_cpus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* L1 data cache size in KB. Could be zero, if the CPU lacks cache.
|
* L1 data cache size in KB. Could be zero, if the CPU lacks cache.
|
||||||
|
@ -649,9 +649,13 @@ libcpuid_warn_fn_t cpuid_set_warn_function(libcpuid_warn_fn_t warn_fun);
|
||||||
void cpuid_set_verbosiness_level(int level);
|
void cpuid_set_verbosiness_level(int level);
|
||||||
|
|
||||||
|
|
||||||
/** @see cpuid_get_cpu_list */
|
/**
|
||||||
|
* @brief a structure that holds a list of processor names
|
||||||
|
*/
|
||||||
struct cpu_list_t {
|
struct cpu_list_t {
|
||||||
|
/** Number of entries in the list */
|
||||||
int num_entries;
|
int num_entries;
|
||||||
|
/** Pointers to names. There will be num_entries of them */
|
||||||
char **names;
|
char **names;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -665,13 +669,11 @@ struct cpu_list_t {
|
||||||
* vendors. The list is written out in approximate chronological introduction
|
* vendors. The list is written out in approximate chronological introduction
|
||||||
* order of the parts.
|
* order of the parts.
|
||||||
*
|
*
|
||||||
* @param vendor - the vendor to be queried
|
* @param vendor the vendor to be queried
|
||||||
* @param list [out] - the resulting list will be written here. The `names'
|
* @param list [out] the resulting list will be written here.
|
||||||
* field of the structure will hold the names (memory is
|
|
||||||
* allocated by this function). `num_entries' will hold
|
|
||||||
* the count.
|
|
||||||
* NOTE: As the memory is dynamically allocated, be sure to call
|
* NOTE: As the memory is dynamically allocated, be sure to call
|
||||||
* @see cpuid_free_cpu_list() after you're done with the data
|
* cpuid_free_cpu_list() after you're done with the data
|
||||||
|
* @see cpu_list_t
|
||||||
*/
|
*/
|
||||||
void cpuid_get_cpu_list(cpu_vendor_t vendor, struct cpu_list_t* list);
|
void cpuid_get_cpu_list(cpu_vendor_t vendor, struct cpu_list_t* list);
|
||||||
|
|
||||||
|
@ -679,7 +681,7 @@ void cpuid_get_cpu_list(cpu_vendor_t vendor, struct cpu_list_t* list);
|
||||||
* @brief Frees a CPU list
|
* @brief Frees a CPU list
|
||||||
*
|
*
|
||||||
* This function deletes all the memory associated with a CPU list, as obtained
|
* This function deletes all the memory associated with a CPU list, as obtained
|
||||||
* by @see cpuid_get_cpu_list()
|
* by cpuid_get_cpu_list()
|
||||||
*
|
*
|
||||||
* @param list - the list to be free()'d.
|
* @param list - the list to be free()'d.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue