Hi Tigran,
The modern CPUs trying to be too smart.
try to run this code to disable CPUs c-states:
----> setcpulatency.c
#include <stdio.h>
#include <fcntl.h>
#include <stdint.h>
int main(int argc, char **argv) {
int32_t l;
int fd;
if (argc != 2) {
fprintf(stderr, "Usage: %s <latency in us>\n", argv[0]);
return 2;
}
l = atoi(argv[1]);
printf("setting latency to %d us\n", l);
fd = open("/dev/cpu_dma_latency", O_WRONLY);
if (fd < 0) {
perror("open /dev/cpu_dma_latency");
return 1;
}
if (write(fd, &l, sizeof(l)) != sizeof(l)) {
perror("write to /dev/cpu_dma_latency");
return 1;
}
while (1) pause();
}
——>
your C code should be equivalent to the following:
echo 0 > /dev/cpu_dma_latency
Right?
I executed the above command but time execution increase of about 2 seconds over 129seconds (I’ve executed the transaction several times repeating the procedure of restarting db and redoing transaction). With setting echo 1 > /dev/cpu_dma_latency it returns to 129seconds.
you can use i7z (https://code.google.com/p/i7z/) to see the percentage of CPU power to be used.
I’ve installed i7z-GUI but it reports the following and crashes with segmentation fault (T420 has Intel Xeon, not i-series):
i7z DEBUG: i7z version: svn-r77-(20-Nov-2011)
i7z DEBUG: Found Intel Processor
i7z DEBUG: Stepping 4
i7z DEBUG: Model e
i7z DEBUG: Family 6
i7z DEBUG: Processor Type 0
i7z DEBUG: Extended Model 3
i7z DEBUG: msr = Model Specific Register
i7z DEBUG: detected a newer model of ivy bridge processor
i7z DEBUG: my coder doesn't know about it, can you send the following info to him?
i7z DEBUG: model e, extended model 3, proc_family 6
i7z DEBUG: msr device files DONOT exist, trying out a makedev script
i7z DEBUG: modprobbing for msr
[1]+ Segmentation fault (core dumped) i7z_GUI
Changing CPU from C1 to C0 takes quite some time and for DB workload not optimal (if you need a
high throughout and any given moment).
I see ~65% boost when run './setcpulatency 0'.
Tigran.
With “takes quite some time” you mean that it will take some time to take effect?
Thank you a lot for your help.
Best regards,
Pietro