You are not logged in.
Pages: 1
Hello,
I'm editing a conky which has rings and a translucent background (both items are known lua scripts by londonali1010) and having an issue with CPU usage. I've had the rings alone sitting on my desktop for a long time without a problem (average CPU usage around 3% when computer was idle), but the moment the cairo function for drawing a translucent background was integrated, CPU usage went up. Now it stays at ~23% from the moment X is started; it goes back to normal if I kill Conky.
The thing is that if now I just call the function which draws the rings and let out the translucent background (as it was before, just there are some more things in the lua script - which are not used if the function for drawing the background is not called), the CPU usage is equally high. So I guess the problem must be some of the configuration settings I added to the conky file for enabling the new background. Tried commenting some of them but saw no improvement.
Here you have a copy of said conky file (you can see that it does not much polling on my system, it's just a clock). If you want to take a look at the lua script, please ask.
# -- Conky settings -- #
background no
update_interval 1
total_run_times 0
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_color 191919
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
border_inner_margin 0
border_outer_margin 0
minimum_size 400 400
maximum_width 500
alignment bottom_right
gap_x -50
gap_y -100
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color aaa
#default_shade_color 000000 #fed053
default_outline_color 7f8f9f
own_window_argb_visual yes
own_window_argb_value 200
# -- Text settings -- #
use_xft yes
xftfont anorexia:size=24
xftalpha 0.4
uppercase no
default_color cccccc
# -- Lua Load -- #
lua_load ~/.conky/draw_bg.lua ~/.conky/rings.lua
lua_draw_hook_pre main
#lua_draw_hook_pre ring_stats
TEXT
${voffset 105}${offset 85}${font Helvetica:size=20}${time %H:%M}${font}Last edited by freieschaf (2011-08-13 18:04:02)
Offline
Well, I've been trying things to solve this and ended up taking out setting lines from the conky file to try and figure out what was causing this. Right now all I have in the file is
own_window yes
minimum_size 400 600
maximum_width 400
alignment bottom_right
gap_x -120
gap_y -200
TEXT
${voffset 105}${offset 85}${font Helvetica:size=20}${time %H:%M}${font}and when executed, it uses about the same percentage of CPU as it did before. From what little I know, this code it's just creating a window, positioning it and printing the time on it; could someone explain to me why does it use so much of the CPU?
Offline
and when executed, it uses about the same percentage of CPU as it did before. From what little I know, this code it's just creating a window, positioning it and printing the time on it; could someone explain to me why does it use so much of the CPU?
# killall conky && conky -c ~/conky/freieschaf &
background no
own_window yes
# own_window_type override
own_window_transparent yes
# own_window_hints skip_taskbar,skip_pager
own_window_title freieschaf
own_window_class freieschaf
double_buffer yes
use_spacer right
override_utf8_locale yes
use_xft yes
xftalpha 1.0
uppercase no
stippled_borders 0
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
default_color FFFFF0 #Ivory
color0 DCDCDC #Gainsboro
color1 CCCCCC #Marks Grey 778899 #LightSlateGrey
color2 7095BB #Marks Blue #FF8C00 #Darkorange
color3 C6FF8E #Light Green #FFF00 #Chartreuse
color4 FFA07A #LightSalmon
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
text_buffer_size 256 # minimum
no_buffers yes
short_units yes
pad_percents 2
imlib_cache_size 0
alignment br ### tl, tr, tm, bl, br, bm, ml, mr
minimum_size 400 600
maximum_width 400
gap_x -120
gap_y -200
font Helvetica:size=20
update_interval 1
TEXT
${voffset 105}${offset 85}${time %H:%M}
CPU: ${cpu} %Use that code for a test and start it in a terminal and show any errors!
Offline
@ freieschaf
Try this modifued LUA script. It eliminates a memory leak:
--[[ Background by londonali1010 (2009)
VinDSL Background Hack (2010-2011)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
Changelog:
+ v3.0 VinDSL Hack (01.28.2011) Killed memory leak.
+ v2.4 VinDSL Hack (01.25.2011) Declared all variables in local.
+ v2.3 VinDSL Hack (12.31.2010) Added shading example(s).
+ v2.2 VinDSL Hack (12.30.2010) Cleaned up the code a bit.
+ v2.1 VinDSL Hack (12.24.2010) Added cairo destroy function(s).
+ v2.0 VinDSL Hack (12.21.2010) Added height adjustment variable.
+ v1.0 Original release (07.10.2009)
]]
-- Change these settings to affect your background:
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
local corner_r = 35
-- Set the colour and transparency (alpha) of your background (0.00 - 0.99).
-- (Light Shading Example)
-- local bg_colour = 0x4d4d4d
-- local bg_alpha = 0.50
-- (Medium Shading Example)
-- local bg_colour = 0x222222
-- local bg_alpha = 0.50
-- (Dark Shading Example)
local bg_colour = 0x000000
local bg_alpha = 0.65
-- local bg_colour = 0x222222
-- local bg_alpha = 0.50
-- Tweaks the height of your background, in pixels. If you don't need to adjust the height, use 0.
-- (Default Setting)
local vindsl_hack_height = 0
-- local vindsl_hack_height = -228
require 'cairo'
local cs, cr = nil
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg()
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local w = conky_window.width
local h = conky_window.height
local v = vindsl_hack_height
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
cairo_move_to(cr,corner_r,0)
cairo_line_to(cr,w-corner_r,0)
cairo_curve_to(cr,w,0,w,0,w,corner_r)
cairo_line_to(cr,w,h+v-corner_r)
cairo_curve_to(cr,w,h+v,w,h+v,w-corner_r,h+v)
cairo_line_to(cr,corner_r,h+v)
cairo_curve_to(cr,0,h+v,0,h+v,0,h+v-corner_r)
cairo_line_to(cr,0,corner_r)
cairo_curve_to(cr,0,0,0,0,corner_r,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
cairo_surface_destroy(cs)
cairo_destroy(cr)
endOffline
Use that code for a test and start it in a terminal and show any errors!
Thanks for your time:) I tried your conky and yet it gets high CPU usage:
The thing is that it does not happen with every conky I have running; I tried another one (which does do system polling) and CPU stays quite relaxed.
Offline
Sector11 wrote:Use that code for a test and start it in a terminal and show any errors!
Thanks for your time:) I tried your conky and yet it gets high CPU usage:
http://thumbnails44.imagebam.com/14471/a39645144706927.jpg
The thing is that it does not happen with every conky I have running; I tried another one (which does do system polling) and CPU stays quite relaxed.
CRAZY ... unless it has to do with this, keep in mind it does nothing to my CPU, with your test I am also running 3 other conkys.
but:
you align it bottom right
alignment brThis looks fine
minimum_size 400 600
maximum_width 400gap_x -120
gap_y -200Hmmmmmmmmmm
gap_x 0 ### left &right
gap_y 0 ### up & downgap_x with a positive number moves conky left OR right ---> into the screen, depending on alignment
- - you are telling conky to move the display 120 pixels farther right off the screen with that negative number.
gap_y with a positive number moves conky up OR down ---> into the screen, depending on alignment
- - you are telling conky to move the display 200 pixels farther down off the screen with that negative number.
BUT conky says: NO NO!! - Display ON THE SCREEN ![]()
TEXT
${voffset 105}${offset 85}${time %H:%M}
CPU: ${cpu} %And after all that - you are telling conky to display the "time" 150 pixels lower than the top of the conky window that is minimum_size 400 600 - 600 pixels high.
The strange thing is it is working here .... and this I do not understand.
Try a test.
kill all your conkys.
killall conkyadd a blank line to the bottom of all conkys and then this - even it is already exists in the conky.
CPU: ${cpu} %then start your conkys one at a time with:
conky -c ~/path/to/conky1 &- - that & is important - once conky is running hit enter in the terminal for a new command line.
- - record the CPU usage
- - kill the conky again and start another conky, recording the CPU usage
Now if they are fine - take whatever you have "above TEXT" and copy paste that to the conky you are having problems with.
make ONLY ONE change:
alignment brand run it to see what happens.
Use this below TEXT:
TEXT
${font Helvetica:size=20}${time %H:%M}
CPU: ${cpu} %${font}Remember - it's only a test.
Offline
Well, that did it so far, thank you.
Used one conky witch CPU running at 1%, copied its whole configuration to the problematic one, changed alignment and CPU stays at 1%. Now I will try to do what I was intending to do by changing bits of that configuration. The thing is, I wanted this conky to have some parts outside the screen, so only one rounded corner was visible, do you mean I cannot use a negative number in alignment? If so maybe it's easier to use an image instead of a script to draw the background.
One way or another, thank you very much for offering ideas
I will post any results when I get something.
Offline
Well, that did it so far, thank you.
Used one conky witch CPU running at 1%, copied its whole configuration to the problematic one, changed alignment and CPU stays at 1%. Now I will try to do what I was intending to do by changing bits of that configuration. The thing is, I wanted this conky to have some parts outside the screen, so only one rounded corner was visible, do you mean I cannot use a negative number in alignment? If so maybe it's easier to use an image instead of a script to draw the background.
One way or another, thank you very much for offering ideas
I will post any results when I get something.
If my memory serves me correct, I have a LUA background script that has settings for "individual" corners, you don't even have to set a height/width in it, it takes that from the conky window.}
I'll have a look ... and get back to you
Glad it worked. A few things I'm learning about conky:
How conky acts/reacts to commands sometimes depends on the
1. desktop or window manager - scrotwm
2. what is compiled into the kernal
3. equipment
As to negative numbers in the gap_x & y - of course you can use them but as they say; your mileage may vary. ![]()
Last edited by Sector11 (2011-08-13 16:16:35)
Offline
Finally it's behaving, even with part out of the screen. You can see the CPU rate on the other conky:
Found out that the line that was causing all this was
own_window_type normalI switched it to desktop and all is well, but have no idea why normal window type would do this to the CPU.
Thank you Sector11 for your time.
Offline
Finally it's behaving, even with part out of the screen. You can see the CPU rate on the other conky:
http://thumbnails55.imagebam.com/14487/ca7edc144865384.jpg
Found out that the line that was causing all this was
own_window_type normalI switched it to desktop and all is well, but have no idea why normal window type would do this to the CPU.
Thank you Sector11 for your time.
No problem looks nice, and seeing a finished conky has it's own rewards.
own_window_type normalI gotta play with this now ...
Last edited by Sector11 (2011-08-13 18:19:35)
Offline
Pages: 1