Re: High priority tasks break SMP balancer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are a couple of points I would make about your python test harness. Your program compares real+system jiffies for both cpus; an ideal result would be 1.00. The measurement is taken over a relatively short period of approximately a half-second, and you kill the CPU hogs before taking final measurements, even wait for them to die first. You repeat this measurement, starting and killing CPU hogs each time. Why do you do that?

What happens if you start the hogs and take the baseline outside of the loop?

   from __future__ import division
   import sys, os, time

   def getCpuTimes():
       cpu0 = 0
       cpu1 = 1
       for line in open("/proc/stat"):
           tokens = line.split()
           if tokens[0] == "cpu0":
               cpu0 = int(tokens[1]) + int(tokens[3])
           elif tokens[0] == "cpu1":
               cpu1 = int(tokens[1]) + int(tokens[3])
       return cpu0, cpu1

   pid = os.spawnl(os.P_NOWAIT, "./priosched")
   baseline = getCpuTimes()
   while True:
       time.sleep(0.5)
       current = getCpuTimes()
       print "%.04f" % (current[0] - baseline[0]) / (current[1] -
   baseline[1])

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux