Sergio-Muriel / theoldreader-cli

The Old Reader API and Terminal/Console GUI
https://github.com/Sergio-Muriel/theoldreader-cli
11 stars 1 forks source link

CPU usage is real high #4

Closed krasnoukhov closed 9 years ago

krasnoukhov commented 9 years ago

I'm not sure why and I'm also not sure if this is specific to OS X, but I'm getting a really high CPU usage.

When loading:

activity monitor all processes 2015-02-16 23-49-33

When already loaded and idle:

activity monitor all processes 2015-02-16 23-52-15

Any ideas?

Sergio-Muriel commented 9 years ago

Just pulled a fix for that, cpu looks fine now. I think it was due to the guibackgrroud jobs.

krasnoukhov commented 9 years ago

I'm wondering which version of perl are you using and how many subscriptions/items do you have? The fact is, issue still persists :person_frowning:

Sergio-Muriel commented 9 years ago

I use perl 5.18. I don't think the number of subscription items matters as the periodic jobs only update the count numbers of the labels, and the right list.

I think you may have high cpu usage when loading (still working on that), but did you have it on iddle too?

If true, maybe you can help me debug it (cause i don't have that issue here)? Just comenting the lines 61/62 on TheoldReader/GuiBackground.pm (to disable the background jobs), so i can see if it is due to the background jobs, or to the frontend loop.

Thank you!

krasnoukhov commented 9 years ago

You're right – commenting the lines you've mentioned reduces CPU usage to, like, zero. I hope that helps!

Sergio-Muriel commented 9 years ago

I made some updates with the treads system to close them properly, so i think there is will be "less?" memory leaks and cpu usage.

krasnoukhov commented 9 years ago

Thanks for the effort, this is really apprecicated. However, still seeing high usage:

activity monitor all processes 2015-02-21 16-49-43

Sorry :(

Sergio-Muriel commented 9 years ago

Hi again. Could you test it again but:

If the cpu is still high, can you send me the log file to check for times on loops?

krasnoukhov commented 9 years ago

Sure, here you go:

$ cat log 
02/22/2015 17:05:25 BG: Waiting for command.
02/22/2015 17:05:25 GUI: Building content
02/22/2015 17:05:26 BG: Waiting for command.
02/22/2015 17:05:27 BG: Waiting for command.
02/22/2015 17:05:28 GUI: Waiting for command.
02/22/2015 17:05:28 BG: Waiting for command.
02/22/2015 17:05:28 BG: Received last clear user/-/state/com.google/reading-list 1 
02/22/2015 17:05:29 BG: Waiting for command.
02/22/2015 17:05:29 BG: Received unread_feeds
02/22/2015 17:05:29 BG: Received last noclear user/-/state/com.google/reading-list 1 
02/22/2015 17:05:30 GUI: Waiting for command.
02/22/2015 17:05:30 BG: Waiting for command.
02/22/2015 17:05:31 BG: Waiting for command.
02/22/2015 17:05:32 GUI: Waiting for command.
02/22/2015 17:05:32 BG: Waiting for command.
02/22/2015 17:05:33 BG: Waiting for command.
02/22/2015 17:05:34 GUI: Waiting for command.
02/22/2015 17:05:34 GUI: Received command update_count
02/22/2015 17:05:34 BG: Waiting for command.
02/22/2015 17:05:35 BG: Waiting for command.
02/22/2015 17:05:36 GUI: Waiting for command.
02/22/2015 17:05:36 BG: Waiting for command.
02/22/2015 17:05:37 BG: Waiting for command.
02/22/2015 17:05:38 GUI: Waiting for command.
02/22/2015 17:05:38 BG: Waiting for command.
02/22/2015 17:05:39 BG: Waiting for command.
02/22/2015 17:05:40 GUI: Waiting for command.
02/22/2015 17:05:40 BG: Waiting for command.
02/22/2015 17:05:41 BG: Waiting for command.
02/22/2015 17:05:42 GUI: Waiting for command.
02/22/2015 17:05:42 BG: Waiting for command.
02/22/2015 17:05:43 BG: Waiting for command.
02/22/2015 17:05:44 GUI: Waiting for command.
02/22/2015 17:05:44 BG: Waiting for command.
02/22/2015 17:05:45 BG: Waiting for command.
02/22/2015 17:05:46 GUI: Waiting for command.
02/22/2015 17:05:46 BG: Waiting for command.
02/22/2015 17:05:47 BG: Waiting for command.
02/22/2015 17:05:48 GUI: Waiting for command.
02/22/2015 17:05:48 BG: Waiting for command.
02/22/2015 17:05:49 BG: Waiting for command.
02/22/2015 17:05:50 GUI: Waiting for command.
02/22/2015 17:05:50 BG: Waiting for command.
02/22/2015 17:05:51 BG: Waiting for command.
02/22/2015 17:05:52 GUI: Waiting for command.
02/22/2015 17:05:52 BG: Waiting for command.
02/22/2015 17:05:53 BG: Waiting for command.
02/22/2015 17:05:54 GUI: Waiting for command.
02/22/2015 17:05:54 BG: Waiting for command.
02/22/2015 17:05:55 BG: Waiting for command.
02/22/2015 17:05:56 GUI: Waiting for command.
02/22/2015 17:05:56 BG: Waiting for command.
02/22/2015 17:05:57 BG: Waiting for command.
02/22/2015 17:05:58 GUI: Waiting for command.
02/22/2015 17:05:58 BG: Waiting for command.
02/22/2015 17:05:59 BG: Waiting for command.
02/22/2015 17:05:00 GUI: Waiting for command.
02/22/2015 17:05:00 BG: Waiting for command.
02/22/2015 17:05:01 BG: Waiting for command.
02/22/2015 17:05:02 GUI: Waiting for command.
02/22/2015 17:05:02 BG: Waiting for command.
02/22/2015 17:05:03 BG: Waiting for command.
02/22/2015 17:05:04 GUI: Waiting for command.
02/22/2015 17:05:04 GUI: Received command display_list clear user/-/state/com.google/reading-list
02/22/2015 17:05:04 BG: Waiting for command.
02/22/2015 17:05:05 BG: Waiting for command.
02/22/2015 17:05:06 GUI: Waiting for command.
02/22/2015 17:05:06 GUI: Received command display_list noclear user/-/state/com.google/reading-list
02/22/2015 17:05:06 BG: Waiting for command.
02/22/2015 17:05:07 BG: Waiting for command.
02/22/2015 17:05:08 GUI: Waiting for command.
02/22/2015 17:05:08 GUI: Received command update_count
02/22/2015 17:05:08 BG: Waiting for command.
02/22/2015 17:05:09 BG: Waiting for command.
02/22/2015 17:05:10 GUI: Waiting for command.
02/22/2015 17:05:10 GUI: Received command update_count
02/22/2015 17:05:10 BG: Waiting for command.
02/22/2015 17:05:11 BG: Waiting for command.
02/22/2015 17:05:12 GUI: Waiting for command.
02/22/2015 17:05:12 BG: Waiting for command.
02/22/2015 17:05:13 BG: Waiting for command.
02/22/2015 17:05:14 GUI: Waiting for command.
02/22/2015 17:05:14 BG: Waiting for command.
02/22/2015 17:05:15 BG: Waiting for command.
02/22/2015 17:05:16 GUI: Waiting for command.
02/22/2015 17:05:16 BG: Waiting for command.
02/22/2015 17:05:17 BG: Waiting for command.
02/22/2015 17:05:18 GUI: Waiting for command.
02/22/2015 17:05:18 BG: Waiting for command.
02/22/2015 17:05:19 BG: Waiting for command.
02/22/2015 17:05:20 GUI: Waiting for command.
02/22/2015 17:05:20 BG: Waiting for command.
02/22/2015 17:05:20 BG: Received quit
02/22/2015 17:05:21 BG: DONE thread bg ! 
02/22/2015 17:05:22 GUI: Waiting for command.
02/22/2015 17:05:22 GUI: Received command quit
02/22/2015 17:05:22 GUI: after Quit2
02/22/2015 17:05:22 GUI: done2
Sergio-Muriel commented 9 years ago

So you didnt notice any improvment at all?

krasnoukhov commented 9 years ago

Looks like CPU is good when idle, but still 200-300% when loading :(

Sergio-Muriel commented 9 years ago

Great, the fixes was for the iddle task. Lets improve loading task!

krasnoukhov commented 9 years ago

Nice! Ping me anytime to test. Hope you can do it!

Sergio-Muriel commented 9 years ago

Great, then. Maybe you could re pull and rerun with -debug option, so i can check the new log commands i just put :)

krasnoukhov commented 9 years ago

Strange, it does not seem to log anything other than

02/22/2015 19:07:32 BG: DONE thread bg ! 
02/22/2015 19:07:33 GUI: done
Sergio-Muriel commented 9 years ago

Try with -debug option

krasnoukhov commented 9 years ago

Damn, sorry for that. Here is the log:

02/22/2015 20:08:09 BG: Waiting for command.
02/22/2015 20:08:09 GUI: Starting build gui
02/22/2015 20:08:09 GUI: Starting build content
02/22/2015 20:08:09 GUI: Building content
02/22/2015 20:08:09 GUI: Starting build help
02/22/2015 20:08:09 GUI: Starting bind keys
02/22/2015 20:08:09 GUI: Starting fetch labels
02/22/2015 20:08:10 BG: Waiting for command.
02/22/2015 20:08:11 GUI: Starting fetch friends
02/22/2015 20:08:11 BG: Waiting for command.
02/22/2015 20:08:12 GUI: Starting fetch friends
02/22/2015 20:08:12 GUI: Waiting for command.
02/22/2015 20:08:12 BG: Waiting for command.
02/22/2015 20:08:12 BG: Received last clear user/-/state/com.google/reading-list 1 
02/22/2015 20:08:13 BG: Waiting for command.
02/22/2015 20:08:13 BG: Received unread_feeds
02/22/2015 20:08:13 BG: Received last noclear user/-/state/com.google/reading-list 1 
02/22/2015 20:08:14 GUI: Waiting for command.
02/22/2015 20:08:14 BG: Waiting for command.
02/22/2015 20:08:15 BG: Waiting for command.
02/22/2015 20:08:16 GUI: Waiting for command.
02/22/2015 20:08:16 BG: Waiting for command.
02/22/2015 20:08:17 BG: Waiting for command.
02/22/2015 20:08:18 GUI: Waiting for command.
02/22/2015 20:08:18 GUI: Received command update_count
02/22/2015 20:08:18 BG: Waiting for command.
02/22/2015 20:08:19 BG: Waiting for command.
02/22/2015 20:08:20 GUI: Waiting for command.
02/22/2015 20:08:20 BG: Waiting for command.
02/22/2015 20:08:21 BG: Waiting for command.
02/22/2015 20:08:22 GUI: Waiting for command.
02/22/2015 20:08:22 BG: Waiting for command.
02/22/2015 20:08:23 BG: Waiting for command.
02/22/2015 20:08:24 GUI: Waiting for command.
02/22/2015 20:08:24 BG: Waiting for command.
02/22/2015 20:08:25 BG: Waiting for command.
02/22/2015 20:08:26 GUI: Waiting for command.
02/22/2015 20:08:26 BG: Waiting for command.
02/22/2015 20:08:27 BG: Waiting for command.
02/22/2015 20:08:28 GUI: Waiting for command.
02/22/2015 20:08:28 BG: Waiting for command.
02/22/2015 20:08:29 BG: Waiting for command.
02/22/2015 20:08:30 GUI: Waiting for command.
02/22/2015 20:08:30 BG: Waiting for command.
02/22/2015 20:08:31 BG: Waiting for command.
02/22/2015 20:08:32 GUI: Waiting for command.
02/22/2015 20:08:32 BG: Waiting for command.
02/22/2015 20:08:33 BG: Waiting for command.
02/22/2015 20:08:34 GUI: Waiting for command.
02/22/2015 20:08:34 BG: Waiting for command.
02/22/2015 20:08:35 BG: Waiting for command.
02/22/2015 20:08:36 GUI: Waiting for command.
02/22/2015 20:08:36 BG: Waiting for command.
02/22/2015 20:08:37 BG: Waiting for command.
02/22/2015 20:08:38 GUI: Waiting for command.
02/22/2015 20:08:38 BG: Waiting for command.
02/22/2015 20:08:39 BG: Waiting for command.
02/22/2015 20:08:40 GUI: Waiting for command.
02/22/2015 20:08:40 BG: Waiting for command.
02/22/2015 20:08:41 BG: Waiting for command.
02/22/2015 20:08:42 GUI: Waiting for command.
02/22/2015 20:08:42 BG: Waiting for command.
02/22/2015 20:08:43 BG: Waiting for command.
02/22/2015 20:08:44 GUI: Waiting for command.
02/22/2015 20:08:44 BG: Waiting for command.
02/22/2015 20:08:45 BG: Waiting for command.
02/22/2015 20:08:46 GUI: Waiting for command.
02/22/2015 20:08:46 BG: Waiting for command.
02/22/2015 20:08:47 BG: Waiting for command.
02/22/2015 20:08:48 GUI: Waiting for command.
02/22/2015 20:08:48 BG: Waiting for command.
02/22/2015 20:08:49 BG: Waiting for command.
02/22/2015 20:08:50 GUI: Waiting for command.
02/22/2015 20:08:50 BG: Waiting for command.
02/22/2015 20:08:51 BG: Waiting for command.
02/22/2015 20:08:52 GUI: Waiting for command.
02/22/2015 20:08:52 BG: Waiting for command.
02/22/2015 20:08:53 BG: Waiting for command.
02/22/2015 20:08:54 GUI: Waiting for command.
02/22/2015 20:08:54 BG: Waiting for command.
02/22/2015 20:08:55 BG: Waiting for command.
02/22/2015 20:08:56 GUI: Waiting for command.
02/22/2015 20:08:56 BG: Waiting for command.
02/22/2015 20:08:57 BG: Waiting for command.
02/22/2015 20:08:58 GUI: Waiting for command.
02/22/2015 20:08:58 BG: Waiting for command.
02/22/2015 20:08:59 BG: Waiting for command.
02/22/2015 20:08:00 GUI: Waiting for command.
02/22/2015 20:08:00 BG: Waiting for command.
02/22/2015 20:08:01 BG: Waiting for command.
02/22/2015 20:08:02 GUI: Waiting for command.
02/22/2015 20:08:02 BG: Waiting for command.
02/22/2015 20:08:03 BG: Waiting for command.
02/22/2015 20:08:04 GUI: Waiting for command.
02/22/2015 20:08:04 BG: Waiting for command.
02/22/2015 20:08:05 BG: Waiting for command.
02/22/2015 20:08:06 GUI: Waiting for command.
02/22/2015 20:08:06 BG: Waiting for command.
02/22/2015 20:08:07 BG: Waiting for command.
02/22/2015 20:08:08 GUI: Waiting for command.
02/22/2015 20:08:08 BG: Waiting for command.
02/22/2015 20:08:09 BG: Waiting for command.
02/22/2015 20:08:10 GUI: Waiting for command.
02/22/2015 20:08:10 BG: Waiting for command.
02/22/2015 20:08:11 BG: Waiting for command.
02/22/2015 20:08:12 GUI: Waiting for command.
02/22/2015 20:08:12 BG: Waiting for command.
02/22/2015 20:08:13 BG: Waiting for command.
02/22/2015 20:08:14 GUI: Waiting for command.
02/22/2015 20:08:14 BG: Waiting for command.
02/22/2015 20:08:15 BG: Waiting for command.
02/22/2015 20:08:16 GUI: Waiting for command.
02/22/2015 20:08:16 BG: Waiting for command.
02/22/2015 20:08:17 BG: Waiting for command.
02/22/2015 20:08:18 GUI: Waiting for command.
02/22/2015 20:08:18 GUI: Received command display_list clear user/-/state/com.google/reading-list
02/22/2015 20:08:18 GUI: Received command display_list noclear user/-/state/com.google/reading-list
02/22/2015 20:08:18 BG: Waiting for command.
02/22/2015 20:08:19 BG: Waiting for command.
02/22/2015 20:08:20 GUI: Waiting for command.
02/22/2015 20:08:20 BG: Waiting for command.
02/22/2015 20:08:21 BG: Waiting for command.
02/22/2015 20:08:22 GUI: Waiting for command.
02/22/2015 20:08:22 GUI: Received command update_count
02/22/2015 20:08:22 GUI: Received command update_count
02/22/2015 20:08:22 BG: Waiting for command.
02/22/2015 20:08:23 BG: Waiting for command.
02/22/2015 20:08:24 GUI: Waiting for command.
02/22/2015 20:08:24 BG: Waiting for command.
02/22/2015 20:08:25 BG: Waiting for command.
02/22/2015 20:08:26 GUI: Waiting for command.
02/22/2015 20:08:26 BG: Waiting for command.
02/22/2015 20:08:27 BG: Waiting for command.
02/22/2015 20:08:28 GUI: Waiting for command.
02/22/2015 20:08:28 BG: Waiting for command.
02/22/2015 20:08:29 BG: Waiting for command.
02/22/2015 20:08:30 GUI: Waiting for command.
02/22/2015 20:08:30 BG: Waiting for command.
02/22/2015 20:08:30 BG: Received quit
02/22/2015 20:08:32 GUI: Waiting for command.
02/22/2015 20:08:32 BG: DONE thread bg ! 
02/22/2015 20:08:34 GUI: Waiting for command.
02/22/2015 20:08:34 GUI: Received command quit
02/22/2015 20:08:34 GUI: done
Sergio-Muriel commented 9 years ago

Just pushed a few changes, can't think i do much more for cpu load.

Sergio-Muriel commented 9 years ago

I removed the use of iconv, waiting for another tip to display utf8 characters on Curses::UI

krasnoukhov commented 9 years ago

Well, thanks for trying. Feel free to close this one if that's all you can do

Sergio-Muriel commented 9 years ago

Finally understoud was you told me about the number of subscription you have.

How much subscriptions do you have? To get labels, i fetch them from subscription_list, and that could be long if you have a lot of subscriptions.

krasnoukhov commented 9 years ago

I don't think a lot, it's around 150.

Sergio-Muriel commented 9 years ago

Cannot reproduce