The LatSched Kernel Patch

The LatSched Kernel Patch is a kernel patch that enables a fine grained scheduler timing measurement.
Download

The LatSched Kernel Patch Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • LatSched Team
  • Publisher web site:
  • http://www.xmailserver.org/linux-patches/lnxsched.html#LatSched

The LatSched Kernel Patch Tags


The LatSched Kernel Patch Description

The LatSched Kernel Patch is a kernel patch that enables a fine grained scheduler timing measurement. The LatSched Kernel Patch is a kernel patch that enables a fine grained scheduler timing measurement by using the kernel function get_cycles() that, on x86 cpu families, uses the rdtsc instruction to fetch the CPU cycle counter. A new character device /dev/latsched (MAJOR = 10 - MINOR = 117) has been introduced to control the behaviour and to fetch data from the kernel scheduler measure code. Other then measuring the scheduler latency this patch can be used to study process scheduling and migration between CPUs.To use the patch a new kernel must be built (with the patch applied) and the new character device /dev/latsched must be created with :# mknod /dev/latsched c 10 117The code that will make use of the LatSched patch must open the device with :if ((lsfd = open("/dev/latsched", O_RDWR)) == -1) { ...}The next step is to set the size of the sample ( circular ) buffer with :if ((res = ioctl(lsfd, LS_SAMPLES, samples))) { ...}Then the code will have to instruct to sampler to start collecting scheduler timings with :if ((res = ioctl(lsfd, LS_START, 0))) { ...}To stop the sampling process a new ioctl() call is necessary :if ((res = ioctl(lsfd, LS_STOP, 0))) { ...}At this point collected data is held inside the scheduler data buffers and must be fetched with something like this :int cpu, ncpus, ii;struct lsctl_getdata lsgd;ncpus = sysconf(_SC_NPROCESSORS_CONF);memset(&lsgd, 0, sizeof(lsgd));lsgd.size = samples;lsgd.data = (struct latsched_sample *) malloc(samples * sizeof(struct latsched_sample));for (cpu = 0; cpu < ncpus; cpu++) { lsgd.cpu = cpu; lsgd.size = samples; if ((res = ioctl(lsfd, LS_FETCH, &lsgd))) { ... } for (ii = 0; ii < lsgd.rsize; ii++) { ... }}


The LatSched Kernel Patch Related Software