LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Should my Conky be using up 0.50% (nearly 20MB) of Memory? (https://www.linuxquestions.org/questions/linux-software-2/should-my-conky-be-using-up-0-50-nearly-20mb-of-memory-4175560256/)

mzsade 11-30-2015 06:09 PM

Should my Conky be using up 0.50% (nearly 20MB) of Memory?
 
Code:

conky.config = {
    alignment = 'top_right',
    background = false,
    cpu_avg_samples = 2,
    top_cpu_separate = false,
    default_color = '#FBFCFF',
    draw_borders = true,
    border_width = 4,
    border_inner_margin = 3,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans Mono:bold:size=12',
    gap_x = 20,
    gap_y = 20,
    minimum_height = 5,
    minimum_width = 342,
    net_avg_samples = 2,
    no_buffers = true,
    double_buffer = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_transparent = true,
    own_window_type = 'desktop',
    own_window_class = 'Conky',
    own_window_hints = 'undecorated',
    override_utf8_locale = true,
    stippled_borders = 0,
    update_interval = 10.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false,
    hddtemp_host,
    hddtemp_port,
    hddtemp_refresh,
    temperature_unit = celsius,
    lua_load = '~/scripts/clock.lua',
    lua_draw_hook_pre = 'draw_clock'
}
conky.text = [[
${color}${font LCDMono:bold:size=12}
$alignc $distribution Sid
$alignc $sysname $kernel
$alignc${color}$font${time %a,%e %b,%Y}
$alignc$color$font${time %I:%M:%S %p}

 ${execi 1800 tail -n 2 /tmp/conky-daylight-inf.result}
${hr 3}
$alignc ${color}${font}Uptime:$color$uptime
${hr 3}
${color} RAM: $mem $memwithbuffers $memperc%
        ${memwithbuffersbar 3,200}       
${color} Swap:$swap  $alignc $swapperc%
${hr 3}
 Core1:$color${cpu cpu1}%      ${alignc}CPU$alignr${if_existing /sys/class/hwmon/hwmon1/temp2_input} Temp:${hwmon 1 temp 2}°C ${else} Temp:${hwmon 2 temp 2}°C ${endif}
 Core2:$color${cpu cpu2}%      $alignc ${cpu cpu0}%$alignr${if_existing /sys/class/hwmon/hwmon1/temp3_input} Temp:${hwmon 1 temp 3}°C ${else} Temp:${hwmon 2 temp 3}°C ${endif}
 Core3:$color${cpu cpu3}%    $alignc Freq$alignr${if_existing /sys/class/hwmon/hwmon1/temp4_input} Temp:${hwmon 1 temp 4}°C ${else} Temp:${hwmon 2 temp 4}°C ${endif}
 Core4:$color${cpu cpu4}%    $alignc ${freq}MHz $alignr${if_existing /sys/class/hwmon/hwmon1/temp5_input} Temp:${hwmon 1 temp 5}°C ${else} Temp:${hwmon 2 temp 5}°C ${endif}
${hr 3}
$alignc HDD Temp:$color${hddtemp /dev/sda}°C
 Root: ${fs_used /} $alignc Used:${fs_used_perc /}%
        ${fs_bar 3, 200 /}
 Home: ${fs_used /home} $alignc Used:${fs_used_perc /home}%
${hr 3}
$alignc${addr} eth0
 Down Speed:${downspeed eth0}
 Up Speed:  ${upspeed eth0}
${hr 3}
  Top Process      CPU    Memory
 ${top name 1} ${top cpu 1}% ${top mem 1}%
 ${top name 2} ${top cpu 2}% ${top mem 2}%
 ${top name 3} ${top cpu 3}% ${top mem 3}%
 ${top name 4} ${top cpu 4}% ${top mem 4}%
 ${top name 5} ${top cpu 5}% ${top mem 5}%
${hr 3}
${alignc}Battery
 ${battery BAT0} ${battery_percent BAT0}
]]

There's also a slight leakage in the lua clock, i have noted over a period of several hours, the memory usage increases to nearly 2%.

Code:

--[[
Air Clock by Alison Pitt (2009)
This clock is designed to look like KDE 4.3's "Air" clock, but from inside Conky.
You can adjust the clock's radius and placement, as well as the size and offset of the drop shadow. You can also choose whether to display the seconds hand. This clock updates every time Conky does, so if you want to show seconds, it is recommended that you set update_interval to no more than 0.5s. If you turn off seconds, you can set the update_interval to as long as 30s.  The settings are in the "Settings" section, starting at Line 21.
Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/clock.lua):
        lua_load ~/scripts/clock.lua
        lua_draw_hook_pre draw_clock
]]

require 'cairo'
function conky_draw_clock()
        if conky_window==nil then return end
        local w=conky_window.width
        local h=conky_window.height
        local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
        cr=cairo_create(cs)
                       
        -- Settings
       
                -- What radius should the clock face (not including border) be, in pixels?
               
                local clock_r=36
       
                -- x and y coordinates, relative to the top left corner of Conky, in pixels
               
                local xc=315
                local yc=114
       
                -- Extent of the shadow, in pixels
               
                shadow_width=5
               
                -- x and y offsets of the drop shadow, relative to the centre of the clock face, in pixels. Can be positive (downward) or negative (upward)
               
                shadow_xoffset=0
                shadow_yoffset=2
               
                -- Do you want to show the second hand? Use this if you use a Conky update_interval > 1s. Can be true or false.
               
                show_seconds=false

        -- Grab time
       
        local hours=os.date("%I")
        local mins=os.date("%M")
        local secs=os.date("%S")
       
        secs_arc=(2*math.pi/60)*secs
        mins_arc=(2*math.pi/60)*mins
        hours_arc=(2*math.pi/12)*hours+mins_arc/12
       
        -- Drop shadow
       
        local ds_pat=cairo_pattern_create_radial(xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25,xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25+shadow_width)
        cairo_pattern_add_color_stop_rgba(ds_pat,0,0,0,0,0.2)
        cairo_pattern_add_color_stop_rgba(ds_pat,1,0,0,0,0)
       
        cairo_move_to(cr,0,0)
        cairo_line_to(cr,w,0)
        cairo_line_to(cr,w,h)
        cairo_line_to(cr,0,h)
        cairo_new_sub_path(cr)
        cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
        cairo_set_source(cr,ds_pat)
        cairo_set_fill_rule(cr,CAIRO_FILL_RULE_EVEN_ODD)
        cairo_fill(cr)
       
        -- Glassy border
       
        cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
        cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
        cairo_set_line_width(cr,1)
        cairo_stroke(cr)
       
        local border_pat=cairo_pattern_create_linear(xc,yc-clock_r*1.25,xc,yc+clock_r*1.25)
       
        cairo_pattern_add_color_stop_rgba(border_pat,0,1,1,1,0.7)
        cairo_pattern_add_color_stop_rgba(border_pat,0.3,1,1,1,0)
        cairo_pattern_add_color_stop_rgba(border_pat,0.5,1,1,1,0)
        cairo_pattern_add_color_stop_rgba(border_pat,0.7,1,1,1,0)
        cairo_pattern_add_color_stop_rgba(border_pat,1,1,1,1,0.7)
        cairo_set_source(cr,border_pat)
        cairo_arc(cr,xc,yc,clock_r*1.125,0,2*math.pi)
        cairo_close_path(cr)
        cairo_set_line_width(cr,clock_r*0.25)
        cairo_stroke(cr)
       
        -- Set clock face
       
        cairo_arc(cr,xc,yc,clock_r,0,2*math.pi)
        cairo_close_path(cr)
       
        local face_pat=cairo_pattern_create_radial(xc,yc-clock_r*0.75,0,xc,yc,clock_r)
       
        cairo_pattern_add_color_stop_rgba(face_pat,0,1,1,1,0.9)
        cairo_pattern_add_color_stop_rgba(face_pat,0.5,1,1,1,0.9)
        cairo_pattern_add_color_stop_rgba(face_pat,1,0.9,0.9,0.9,0.9)
        cairo_set_source(cr,face_pat)
        cairo_fill_preserve(cr)
        cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
        cairo_set_line_width(cr, 1)
        cairo_stroke (cr)
       
        -- Draw hour hand
       
        xh=xc+0.7*clock_r*math.sin(hours_arc)
        yh=yc-0.7*clock_r*math.cos(hours_arc)
        cairo_move_to(cr,xc,yc)
        cairo_line_to(cr,xh,yh)
       
        cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
        cairo_set_line_width(cr,5)
        cairo_set_source_rgba(cr,0,0,0,0.5)
        cairo_stroke(cr)
       
        -- Draw minute hand
       
        xm=xc+0.9*clock_r*math.sin(mins_arc)
        ym=yc-0.9*clock_r*math.cos(mins_arc)
        cairo_move_to(cr,xc,yc)
        cairo_line_to(cr,xm,ym)
       
        cairo_set_line_width(cr,3)
        cairo_stroke(cr)
       
        -- Draw seconds hand
       
        if show_seconds then
                xs=xc+0.9*clock_r*math.sin(secs_arc)
                ys=yc-0.9*clock_r*math.cos(secs_arc)
                cairo_move_to(cr,xc,yc)
                cairo_line_to(cr,xs,ys)
       
                cairo_set_line_width(cr,1)
                cairo_stroke(cr)
                cairo_destroy(cr)
                cairo_surface_destroy(c)
        end
       
end

Would appreciate any suggestions, even a "don't worry, that's quite normal" from a Conky expert would set my mind at ease.:)

Habitual 11-30-2015 06:29 PM

Rem out the two lines
Code:

    lua_load = '~/scripts/clock.lua',
    lua_draw_hook_pre = 'draw_clock'

and compare? :)

mzsade 11-30-2015 06:35 PM

I did that, doesn't make any difference, the leakage over a period of time caused by it stops but usage never goes below 0.49%. Did the same with the Daylight-info execi line, same thing.

Habitual 11-30-2015 08:07 PM

conky version?

mzsade 11-30-2015 08:19 PM

1 Attachment(s)
conky 1.10.0 compiled Wed Jul 1 08:01:11 UTC 2015 for Linux 3.16.0-4-amd64 x86_64

Would my having upgraded to kernel 4.1.12 have something to do with it?

Killed conky and restarted it, note that it starts at 0.49% of memory.

Habitual 11-30-2015 09:34 PM

It could be the new kernel. It's hard to say.
I asked a friend of mine who's still into conky if he's aware of any issues with conky 1.10.0 on kernel 3.16.x vs 4.1.x
I should have an answer "tomorrow".
He's in another hemisphere, literally.

mzsade 12-01-2015 12:26 AM

Thanks, means a lot, you taking the trouble. Thought i'd try out gkrellm and see how it compared..it's even worse, memory usage is 0.57% with no Built-ins but just the hostname and the gkrellmoon plugin enabled. I am certainly better off with Conky even if it's not optimal yet. ;)

astrogeek 12-01-2015 12:45 AM

I had never paid much attention to conky's RAM usage, but just had a look:

Code:

Slackware 14.1 (32 bit)
conky-1.9.0-i486-1_SBo
RAM: 2GB
Conky RAM usage: 0.44%, about 8.8MB

My conky rules are pretty light compared to those you posted as well.

I would consider my ~10MB on 32 bit machine comparable to your ~20MB on 64 bit machine, but would not consider either to be unusual by current software standards (or lack thereof).

Is it causing you problems or are you just surprised at the memory footprint?

mzsade 12-01-2015 01:42 AM

Quote:

Originally Posted by astrogeek (Post 5457733)
...My conky rules are pretty light compared to those you posted as well.

How do mean, lighter? I was under the impression that i'd the bare minimum that was required for a proper Hardware Monitor..apart from the lua-clock which is the only thing of beauty in it :)

Quote:

I would consider my ~10MB on 32 bit machine comparable to your ~20MB on 64 bit machine, but would not consider either to be unusual by current software standards (or lack thereof).
That's somewhat comforting

Quote:

Is it causing you problems or are you just surprised at the memory footprint?
Nope, no problems, i am just persnickety about system resource usage on my Debian partition as i have gone to a lot of trouble trying to make it as lean as i could. For luxury i use my LMDE partition. :D

astrogeek 12-01-2015 02:44 AM

1 Attachment(s)
I would judge lighter just by length of code, but I also see you are drawing yours with cairo moves which I am not.

Here is mine (I am definitely NOT a conky expert! No laughs, please!) ;)

Code:

#Robert's conky config for Fluxbox
#
alignment bottom_right
gap_x 10
#gap_y 40
gap_y -4

double_buffer yes
own_window yes
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar

default_color A0A0C0
use_xft

xftalpha 0.8
xftfont Verdana:size=8

stippled_borders

TEXT
${color FDB927}${hr}${color A0A0C0}
${image /home/robert/Pictures/slack_ball2.png -p 0,12}


${color FDB927}${hr}${color A0A0C0}
${font size 9}${alignc}PEGASUS${font}
${color FDB927}${hr}${color A0A0C0}
Kernel: ${alignr}${kernel}
Uptime: ${alignr}${uptime}
Disk I/O: ${alignr}${alignc}${diskiograph  /dev/sda 16,140 222266 FD8927 }
RAM:  ${alignr}$mem  /  ${alignr}$memmax
SWAP: ${alignr}$swap  /  ${alignr}$swapmax
${color FDB927}${hr}${color A0A0C0}
CPU Temperature: ${execpi 10 cat /sys/devices/virtual/thermal/thermal_zone0/temp |sed 's/000$//' }°C
HDD Temperature: ${execpi 10 cat /sys/devices/virtual/thermal/thermal_zone1/temp |sed 's/000$//' }°C
${color FDB927}${hr}${color A0A0C0}
Processes: ${alignc}        ${processes}
Top 5 Processes      PID    CPU    MEM
${top name 1} ${alignr}${top pid 1} ${top cpu 1} ${top mem 1}
${top name 2} ${alignr}${top pid 2} ${top cpu 2} ${top mem 2}
${top name 3} ${alignr}${top pid 3} ${top cpu 3} ${top mem 3}
${top name 4} ${alignr}${top pid 4} ${top cpu 4} ${top mem 4}
${top name 5} ${alignr}${top pid 5} ${top cpu 5} ${top mem 5}
${color FDB927}${hr}${color A0A0C0}
      CPU ${alignr}${alignc}${cpugraph 16,60 222266 FD8927} Dl ${downspeedgraph  eth0 16,35 222266 FD8927 } Ul ${upspeedgraph  eth0 16,35 222266 FD8927}

And here is what it looks like...

mzsade 12-01-2015 03:18 AM

That's a pretty neat looking conky, and you even have several graphs running! But i need to keep an eye on those individual core temps. and how they fluctuate with usage, even if those readings are the problem. I will certainly try to trim some redundant bits from the configuration settings like shades, graphs, color etc along the lines of yours though and see if that makes a difference. Remember reading somewhere that keeping the alignment "bottom_right" also helps. Will try it out. Thanks for the code.

Btw, it's only the clock which uses cairo and as i said, deleting those lines does not decrease the memory usage, only prevents the slow leakage, ie. now after a little over 5 hrs. of Uptime, it has gone up from 0.49% to 0.69%. I created a kill switch in my openbox root menu just for that.

Edit: Learned something new about the "$image" variable. There's this Debian swirl i'd downloaded, it's a 1028x1270 pixel image. Wanted to display it as an icon in the top left corner of my Conky. First i tried ${image /image_path -s 36x45}. The memory immediately jumped to 0.66%. So i scaled it down with Gimp and used it without the scaling operator, and guess what, the memory usage dropped down to 0.54%. How inefficient is the scaling operation in Conky, eh? Still, even without it, this pre-scaled icon meant an increase of 0.05% (from 0.49% earlier), that's as much memory as my elaborate lua clock uses, with cairo and all!

Habitual 12-01-2015 09:01 AM

Quote:

Originally Posted by mzsade (Post 5457727)
Thanks, means a lot, you taking the trouble.

Well, it's not good news, nor bad news (well it is, for him).
My contact says only he has the 3.16 kernel only using conky 1.9 only.
And he has 2000 conkys to 'update'. Yikes.

wrt 1.10.x and LUA: "some elements that aren't working from what I've read" is all he said.
I wish I had more to tell you, but I don't.

Sorry about that.
It's been my experience that conky does cost resources to monitor resources.
Image the overhead on this
I never thought twice about it on my 2g of RAM system.

mzsade 12-01-2015 09:49 AM

Thanks for trying, it only remains for me to take mine apart one object variable at a time and see which ones are the most costly, already found that about <$image>.
As to that Conky image, WOW! Now that's enthusiasm, that's dedication, that's art, what's a few hundred measly MBs for something like that. :)

rokytnji 12-01-2015 10:50 AM

Mines pretty simple but we may be comparing apples to oranges here. This is my Ubuntu minimal install with

Code:

harry@biker:~$ apt-cache policy conky-std
conky-std:
  Installed: 1.9.0-4
  Candidate: 1.9.0-4
  Version table:
 *** 1.9.0-4 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

Code:

# Default colors and also border colors, grey90 == #e5e5e5
default_color white

own_window_colour black

# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
use_xft yes
xftfont Sans Bold
uppercase no # set to yes if you want all text to be in uppercase

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_class Conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 24

gap_y 24

# stuff after 'TEXT' will be formatted on screen


TEXT
${color }$nodename ${hr}
${color #9fb6cd}Kernel:$alignr${color }$kernel
${color #9fb6cd}UpTime: $alignr${color }$uptime
${cpugraph 20,200 000000 ffffff}
${color #9fb6cd}Load: $alignr${color }$loadavg
#${color #9fb6cd}Processes: $alignr${color }$processes
#${color #9fb6cd}Running: $alignr${color }$running_processes
${color #9fb6cd}Highest CPU:
${color #ddaa00} ${top name 1}$alignr${top_mem cpu 1}
#${color lightgrey} ${top name 2}$alignr${top cpu 2}
${color lightgrey} ${top name 3}$alignr${top cpu 3}
#${color lightgrey} ${top name 4}$alignr${top cpu 4}
#${color lightgrey} ${top name 5}$alignr${top cpu 5}
Ram : $mem - $memmax - $memperc 
Swap: $swap  $swapmax ${swapbar 7,89} 
${color #9fb6cd}Highest MEM:
${color #ddaa00} ${top_mem name 1}$alignr${top_mem mem 1}
#${color lightgrey} ${top_mem name 2}$alignr${top_mem mem 2}
#${color lightgrey} ${top_mem name 3}$alignr${top_mem mem 3}
#${color lightgrey} ${top_mem name 4}$alignr${top_mem mem 4}
#${color lightgrey} ${top_mem name 5}$alignr${top_mem mem 5}
#${color #9fb6cd}CPU TEMP:$alignr${color}${hddtemp /dev/sda}
#${color #9fb6cd}MEM: $alignr${color } $memperc% $mem/$memmax
${membar 3,100}
${color #9fb6cd}ROOT: $alignr${color }${fs_free /}/${fs_size /}
${fs_bar 3,100 /}
${color #9fb6cd}HOME: $alignr${color }${fs_free /home}/${fs_size /home}
${fs_bar 3,100 /home}
${color #9fb6cd}STUFF: $alignr${color }${fs_free /media/harry/_stuff}/${fs_size /media/harry/_stuff}
${fs_bar 3,100 /media/harry/_stuff}
#${color white}link strength: ${color white} ${wireless_link_bar 7,50 wlan0}

${color #9fb6cd}${time %a, } $alignr${color }${time %e %B %G}
${color #9fb6cd}${time %Z, }$alignr${color }${time %H:%M:%S}
#Tempurature: $alignr${hwmon 1 temp 1}° C
Tempurature CPU: $alignr${acpitemp}° C
Weather:  ${execi 300 /home/harry/weather 79772}

It is a single cpu amd box in the Motorcycle shop office for customers to play with while waiting.

http://i.imgur.com/PT8EKCo.jpg

On my AntiX laptops and netbooks with 4.3 kernels. No problems with conky on those. Here is my pastebin account with certain saved conkyrc of mine.
You are welcome to them
http://pastebin.com/u/rokytnji

Habitual 12-01-2015 11:01 AM

Quote:

Originally Posted by mzsade (Post 5457933)
As to that Conky image, WOW! Now that's enthusiasm, that's dedication, that's art, what's a few hundred measly MBs for something like that. :)

I retired from conky after that.
It became apparent that I had another addiction.


All times are GMT -5. The time now is 02:59 PM.