0

My Kivy application is suffering from a noticeable response lag to touch events, on my test machine:

  • Deb Jessie, Python 2.7, Kivy 1.9.1
  • Intel Atom 1860 Mhz
  • Geforce GT610 4GB RAM SSD
  • 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux

It runs fine on my iMac, and whilst the Mac is obviously a lot more powerful, I don't believe my deb machine should be struggling. Yet, Python is sitting at around 85% CPU when the app is ticking over, and any touch events cause that to fly up to around 235%.

Now, I'm going to take a wild guess that my code is to blame, but can anyone suggest a howto or process to go through to start finding out what / which parts of the code are responsible? I have 3 threads running (apart from Kivy), which seem to look ok, but ideally I guess I'm looking for a 'top' command in Python as a start ;)

EDIT ok, so I've now run the script through cProfile, which seems to suggest that this is the top user of cpu:

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1    0.000    0.000   11.158   11.158 <string>:1(<module>)

To quote the brilliant Ultravox, 'This means nothing to me'...

user4893295
  • 533
  • 6
  • 25
  • 1
    A simple start would be to try running a trivial kivy app and see if the issues persist. If they don't, you can be sure it's something in your code causing the problem. If they do, it's something in Kivy. – inclement Jun 08 '16 at 21:36
  • You can try profiling your code in order to detect which part of it is to blame. For example you can try use [profile](https://pymotw.com/2/profile/) module. – Nykakin Jun 08 '16 at 21:48
  • Ok thanks, have added the result of cProfile to the question. Still confused! – user4893295 Jun 09 '16 at 14:05
  • See [this](http://stackoverflow.com/questions/5964126/pythons-profile-module-string1) – Nykakin Jun 09 '16 at 15:26
  • I'm still struggling with this. In particular, the CPU usage in 'top' flying up to 200-300% on a touch event. Surely this is not my code that is doing this - it happens even when the event that is called by the touch is simply testing a variable!!? – user4893295 Jun 20 '16 at 14:50

0 Answers0