Skip to content

Commit

Permalink
stats: add cores count to the cpu vid
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed May 21, 2016
1 parent af6d562 commit ebbc7e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ extern int longpoll_thr_id;
extern int stratum_thr_id;
extern int api_thr_id;
extern int opt_n_threads;
extern int num_cpus;
extern struct work_restart *work_restart;
extern uint32_t opt_work_size;
extern double *thr_hashrates;
Expand Down
12 changes: 6 additions & 6 deletions sysinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ void cpu_getmodelid(char *outbuf, size_t maxsz)
{
memset(outbuf, 0, maxsz);
#ifdef WIN32
// For the i7-5775C will output 6 r4701
snprintf(outbuf, maxsz, "%s:%s",
getenv("PROCESSOR_LEVEL"), getenv("PROCESSOR_REVISION")); // hexa
// For the i7-5775C will output 6:4701:8
snprintf(outbuf, maxsz, "%s:%s:%s", getenv("PROCESSOR_LEVEL"), // hexa ?
getenv("PROCESSOR_REVISION"), getenv("NUMBER_OF_PROCESSORS"));
#else
FILE *fd = fopen("/proc/cpuinfo", "rb");
char *buf = NULL, *p, *eol;
int level = 0, cpufam = 0, model = 0, stepping = 0;
int cpufam = 0, model = 0, stepping = 0;
size_t size = 0;
if (!fd) return;
while(getdelim(&buf, &size, 0, fd) != -1) {
Expand All @@ -175,8 +175,8 @@ void cpu_getmodelid(char *outbuf, size_t maxsz)
stepping = atoi(p);
}
}
if (level && cpufam) {
snprintf(outbuf, maxsz, "%x:%02x%02x", cpufam, model, stepping);
if (cpufam && model && stepping) {
snprintf(outbuf, maxsz, "%x:%02x%02x:%d", cpufam, model, stepping, num_cpus);
outbuf[maxsz-1] = '\0';
break;
}
Expand Down

0 comments on commit ebbc7e9

Please sign in to comment.