weixin_39582724
weixin_39582724
2021-01-11 04:49

${top cpu 1} Displays incorrect CPU utilization

I am running 2 conky processes, one of which is listing the top 6 processes by cpu, and the top 6 processes by memory. For brevity, the part of my conky.conf doing this is:


conky.text = [[
...
        ${offset 13}${voffset 18}TOP CPU%:${color4}
        ${top name 1}${goto 170}${top cpu 1}%${alignr 205}${top mem_res 1}${color2}
        ${top name 2}${goto 170}${top cpu 2}%${alignr 205}${top mem_res 2}
        ${top name 3}${goto 170}${top cpu 3}%${alignr 205}${top mem_res 3}
        ${top name 4}${goto 170}${top cpu 4}%${alignr 205}${top mem_res 4}
        ${top name 5}${goto 170}${top cpu 5}%${alignr 205}${top mem_res 5}
        ${top name 6}${goto 170}${top cpu 6}%${alignr 205}${top mem_res 6}
        ${goto 345}${voffset -98}${color1}TOP MEM:${color4}
        ${goto 335}${top_mem name 1}${alignr 0}${top_mem mem_res 1}${color2}
        ${goto 335}${top_mem name 2}${alignr 0}${top_mem mem_res 2}
        ${goto 335}${top_mem name 3}${alignr 0}${top_mem mem_res 3}
        ${goto 335}${top_mem name 4}${alignr 0}${top_mem mem_res 4}
        ${goto 335}${top_mem name 5}${alignr 0}${top_mem mem_res 5}
        ${goto 335}${top_mem name 6}${alignr 0}${top_mem mem_res 6}
...
]]

Everything looks great, and is displaying fine, except conky is reporting significantly lower CPU utilization per process than top is. My other conky process is displaying the overall cpu utilization, i.e. ${cpu cpu0}, which matches top very closely. For instance, while watching netflix within firefox, top reports X as the top process with a cpu utilization of 26%, while my conky shows X with 4.55%. My overall cpu usage via top is ~10%, and conky is reporting about the same, via ${cpu cpu0}. Any help is much appreciated.

Here are the options I am using:


conky.config = {
        update_interval = 1,
        total_run_times = 0,
        net_avg_samples = 1,
        cpu_avg_samples = 1,
        double_buffer = true,
        no_buffers = true,
        use_xft = true,
        font = 'DejaVu Sans:size=9',
        override_utf8_locale = true,
        text_buffer_size = 2048,
        border_inner_margin = 30,

        own_window = true,
        own_window_title = 'stats',
        own_window_hints = 'undecorated,above,sticky,skip_taskbar,skip_pager',
        own_window_argb_visual = true,
        own_window_argb_value = 150,
        own_window_type = 'normal',

        alignment = 'top_right',
        gap_x = 200,
        gap_y = 100,
        draw_shades = false,
        default_color = 'ffffff',
        default_shade_color = '000000',
        color0 = '00d9ff',
        color1 = 'd90303',
        color2 = 'e0e0e0',
        color3 = 'ff8400',
        color4 = '44c144',

        format_human_readable = true,
        minimum_width = 464,
        minimum_height = 760,

        lua_load = '~/.conky/rings.lua',
        lua_draw_hook_pre = 'ring_stats'
};

I am running gentoo linux on an x86_64 arch (i7 w/4 hyperthreaded cores) using kernel 4.12.12 and conky 1.10.4 from the main gentoo repository.

Here is how I built conky:


[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for app-admin/conky-1.10.4:
 U I
 + + X             : Add support for X11
 - - apcupsd       : Enable support for sys-power/apcupsd
 - - cmus          : Enable monitoring of music played by media-sound/cmus
 + + curl          : Add support for client-side URL transfer library
 + + eve           : Enable support for the eve-online skill monitor
 - - hddtemp       : Enable monitoring of hdd temperature (app-admin/hddtemp)
 - - ical          : Enable support for events from iCalendar (RFC 5545) files using dev-libs/libical
 + + iconv         : Enable support for the iconv character set conversion library
 + + imlib         : Add support for imlib, an image loading and rendering library
 + + iostats       : Enable support for per-task I/O statistics
 - - ipv6          : Add support for IP version 6
 - - irc           : Enable support for displaying everything from an irc channel using net-libs/libircclient
 + + lua-cairo     : Enable if you want Lua Cairo bindings
 + + lua-imlib     : Enable if you want Lua Imlib2 bindings
 + + lua-rsvg      : Enable if you want Lua RSVG bindings
 - - math          : Enable support for glibc's libm math library
 - - moc           : Enable monitoring of music played by media-sound/moc
 - - mpd           : Enable monitoring of music controlled by media-sound/mpd
 - - mysql         : Add mySQL Database support
 - - nano-syntax   : Enable syntax highlighting for app-editors/nano
 + + ncurses       : Add ncurses support (console display library)
 + + nvidia        : Enable reading of nvidia card temperature sensors via media-video/nvidia-settings
 + + portmon       : Enable support for tcp (ip4) port monitoring
 + + pulseaudio    : Add support for PulseAudio sound server
 - - rss           : Enable support for RSS feeds
 - - systemd       : Enable use of systemd-specific libraries and features like socket activation or session tracking
 - - thinkpad      : Enable support for IBM/Lenovo notebooks
 + + truetype      : Add support for FreeType and/or FreeType2 fonts
 + + vim-syntax    : Pulls in related vim syntax scripts
 + + weather-metar : Enable support for metar weather service
 - - weather-xoap  : Enable support for metar and xoap weather service
 - - webserver     : Enable support to act as a webserver serving conkys output using net-libs/libmicrohttpd
 + + wifi          : Enable wireless network functions
 - - xmms2         : Enable monitoring of music played by media-sound/xmms2

Thanks!

BTW, conky is awesome! I wouldn't trade i for any other monitoring software.

该提问来源于开源项目:brndnmtthws/conky

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39860064 weixin_39860064 4月前

    8 months passed and many things were merged. Is it still causing the same problem for you today?

    点赞 评论 复制链接分享
  • weixin_39860064 weixin_39860064 4月前

    Can you try https://github.com/brndnmtthws/conky/issues/189#issuecomment-411828451? Thank you.

    点赞 评论 复制链接分享
  • weixin_39860064 weixin_39860064 4月前

    Duplicate #189? Do you agree?

    点赞 评论 复制链接分享
  • weixin_39603492 weixin_39603492 4月前

    : I think yes. With awakenedtechnologies's config file, ${top cpu 1} shows me ~50% CPU usage for c-ray-mt process instead of 100%.

    : Are you using BFS/MuQSS CPU scheduler?

    点赞 评论 复制链接分享
  • weixin_39860064 weixin_39860064 4月前

    Duplicate #189. Thank you for the report .

    点赞 评论 复制链接分享