From 68ea7a78590ad9b7a6ce7ea2ab1b7eeb395154b5 Mon Sep 17 00:00:00 2001 From: Yeon-Hyeong Yang Date: Fri, 1 May 2009 17:03:59 -0600 Subject: [PATCH] Added diskio_avg_samples patch (thanks Yeon-Hyeong) --- ChangeLog | 3 + README | 317 ++++++++++++++++++++++------------------------- doc/config_settings.xml | 17 ++- doc/conky.1 | 18 +-- src/conky.c | 15 ++- src/conky.h | 2 + src/diskio.c | 40 ++++-- src/diskio.h | 15 ++- 8 files changed, 233 insertions(+), 194 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dc693c..8f4f21c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2009-05-01 + * Added diskio_avg_samples patch (thanks Yeon-Hyeong) + +2009-05-01 * Conky 1.7.0 "Hungry Hobo" released! 2009-04-30 diff --git a/README b/README index 6516daf..89a1888 100644 --- a/README +++ b/README @@ -173,15 +173,15 @@ conky(1) conky(1) background Boolean value, if true, Conky will be forked to background when - started + started. border_margin - Border margin in pixels + Border margin in pixels. border_width - Border width in pixels + Border width in pixels. colorN Predefine a color for use inside TEXT segments. Substitute N by @@ -190,7 +190,11 @@ conky(1) conky(1) cpu_avg_samples - The number of samples to average for CPU monitoring + The number of samples to average for CPU monitoring. + + + diskio_avg_samples + The number of samples to average for disk I/O monitoring. top_cpu_separate @@ -202,7 +206,7 @@ conky(1) conky(1) default_bar_size Specify a default width and height for bars. Example: 'de‐ fault_bar_size 0 6'. This is particularly useful for execbar and - execibar as they do not take size arguments + execibar as they do not take size arguments. default_graph_size @@ -672,12 +676,17 @@ conky(1) conky(1) a digit between 0 and 9, inclusively. - conky_version - Conky version + combine var1 var2 + Places the lines of var2 to the right of the lines of var1 + seperated by the chars that are put between var1 and var2. For + example: ${combine ${head /proc/cpuinfo 2} - ${head /proc/memin‐ + fo 1}} gives as output "cpuinfo_line1 - meminfo_line1" on line 1 + and "cpuinfo_line2 -" on line 2. $combine vars can also be nest‐ + ed to place more vars next to each other. - combine var1 var2 - Places the lines of var2 to the right of the lines of var1 seperated by the chars that are put between var1 and var2. For example: ${combine ${head /proc/cpuinfo 2} - ${head /proc/meminfo 1}} gives as output "cpuinfo_line1 - meminfo_line1" on line 1 and "cpuinfo_line2 -" on line 2. $combine vars can also be nested to place more vars next to each other. + conky_version + Conky version conky_build_date @@ -689,26 +698,26 @@ conky(1) conky(1) cpu (cpuN) - CPU usage in percents. For SMP machines, the CPU number can be - provided as an argument. ${cpu cpu0} is the total usage, and + CPU usage in percents. For SMP machines, the CPU number can be + provided as an argument. ${cpu cpu0} is the total usage, and ${cpu cpuX} (X >= 1) are individual CPUs. cpubar (cpuN) (height),(width) - Bar that shows CPU usage, height is bar's height in pixels. See + Bar that shows CPU usage, height is bar's height in pixels. See $cpu for more info on SMP. cpugauge (cpuN) (height),(width) - Elliptical gauge that shows CPU usage, height and width are - gauge's vertical and horizontal axis respectively. See $cpu for + Elliptical gauge that shows CPU usage, height and width are + gauge's vertical and horizontal axis respectively. See $cpu for more info on SMP. - cpugraph (cpuN) ("normal"|"log") (height),(width) (gradient colour 1) + cpugraph (cpuN) ("normal"|"log") (height),(width) (gradient colour 1) (gradient colour 2) (scale) - CPU usage graph, with optional colours in hex, minus the #. See - $cpu for more info on SMP. Uses a logarithmic scale (to see + CPU usage graph, with optional colours in hex, minus the #. See + $cpu for more info on SMP. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal". @@ -719,7 +728,7 @@ conky(1) conky(1) diskiograph ("normal"|"log") (height),(width) (gradient colour 1) (gra‐ dient colour 2) (scale) (device) - Disk IO graph, colours defined in hex, minus the #. If scale is + Disk IO graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "nor‐ mal". @@ -729,11 +738,11 @@ conky(1) conky(1) Displays current disk IO for reads. Device as in diskio. - diskiograph_read ("normal"|"log") (height),(width) (gradient colour 1) + diskiograph_read ("normal"|"log") (height),(width) (gradient colour 1) (gradient colour 2) (scale) (device) Disk IO graph for reads, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device as - in diskio. Uses a logarithmic scale (to see small numbers) when + in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal". @@ -743,9 +752,9 @@ conky(1) conky(1) diskiograph_write ("normal"|"log") (height),(width) (gradient colour 1) (gradient colour 2) (scale) (device) - Disk IO graph for writes, colours defined in hex, minus the #. + Disk IO graph for writes, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. Device - as in diskio. Uses a logarithmic scale (to see small numbers) + as in diskio. Uses a logarithmic scale (to see small numbers) when you use "log" instead of "normal". @@ -762,11 +771,11 @@ conky(1) conky(1) Download speed in KiB with one decimal - downspeedgraph ("normal"|"log") (height),(width) (gradient colour 1) + downspeedgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradient colour 2) (scale) (net) - Download speed graph, colours defined in hex, minus the #. If - scale is non-zero, it becomes the scale for the graph. Uses a - logarithmic scale (to see small numbers) when you use "log" in‐ + Download speed graph, colours defined in hex, minus the #. If + scale is non-zero, it becomes the scale for the graph. Uses a + logarithmic scale (to see small numbers) when you use "log" in‐ stead of "normal". @@ -787,40 +796,40 @@ conky(1) conky(1) eval string Evalutates given string according to the rules of TEXT interpre‐ - tation, i.e. parsing any contained text object specifications - into their output, any occuring '$$' into a single '$' and so + tation, i.e. parsing any contained text object specifications + into their output, any occuring '$$' into a single '$' and so on. The output is then being parsed again. exec command Executes a shell command and displays the output in conky. warn‐ - ing: this takes a lot more resources than other variables. I'd + ing: this takes a lot more resources than other variables. I'd recommend coding wanted behaviour in C and posting a patch. execbar command - Same as exec, except if the first value return is a value be‐ - tween 0-100, it will use that number for a bar. The size for + Same as exec, except if the first value return is a value be‐ + tween 0-100, it will use that number for a bar. The size for bars can be controlled via the default_bar_size config setting. execgauge command - Same as exec, except if the first value returned is a value be‐ - tween 0-100, it will use that number for a gauge. The size for - gauges can be controlled via the default_gauge_size config set‐ + Same as exec, except if the first value returned is a value be‐ + tween 0-100, it will use that number for a gauge. The size for + gauges can be controlled via the default_gauge_size config set‐ ting. execgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐ ent colour 2) (scale) command Same as execbar, but graphs values. Uses a logaritmic scale when - the log option is given (to see small numbers). Values still - have to be between 0 and 100. The size for graphs can be con‐ + the log option is given (to see small numbers). Values still + have to be between 0 and 100. The size for graphs can be con‐ trolled via the default_graph_size config setting. execi interval command - Same as exec but with specific interval. Interval can't be less + Same as exec but with specific interval. Interval can't be less than update_interval in configuration. See also $texeci @@ -838,14 +847,14 @@ conky(1) conky(1) execp command Executes a shell command and displays the output in conky. warn‐ - ing: this takes a lot more resources than other variables. I'd + ing: this takes a lot more resources than other variables. I'd recommend coding wanted behaviour in C and posting a patch. This - differs from $exec in that it parses the output of the command, - so you can insert things like ${color red}hi!${color} in your - script and have it correctly parsed by Conky. Caveats: Conky - parses and evaluates the output of $execp every time Conky + differs from $exec in that it parses the output of the command, + so you can insert things like ${color red}hi!${color} in your + script and have it correctly parsed by Conky. Caveats: Conky + parses and evaluates the output of $execp every time Conky loops, and then destroys all the objects. If you try to use any‐ - thing like $execi within an $execp statement, it will function‐ + thing like $execi within an $execp statement, it will function‐ ally run at the same interval that the $execp statement runs, as it is created and destroyed at every interval. @@ -853,44 +862,29 @@ conky(1) conky(1) execpi interval command Same as execp but with specific interval. Interval can't be less than update_interval in configuration. Note that the output from - the $execpi command is still parsed and evaluated at every in‐ + the $execpi command is still parsed and evaluated at every in‐ terval. font (font) - Specify a different font. This new font will apply to the cur‐ - rent line and everything following. You can use a $font with no - arguments to change back to the default font (much like with + Specify a different font. This new font will apply to the cur‐ + rent line and everything following. You can use a $font with no + arguments to change back to the default font (much like with $color) freq (n) - Returns CPU #n's frequency in MHz. CPUs are counted from 1. If + Returns CPU #n's frequency in MHz. CPUs are counted from 1. If omitted, the parameter defaults to 1. freq_g (n) - Returns CPU #n's frequency in GHz. CPUs are counted from 1. If + Returns CPU #n's frequency in GHz. CPUs are counted from 1. If omitted, the parameter defaults to 1. -<<<<<<< HEAD:README - freq_dyn (n) - Returns CPU #n's frequency in MHz (defaults to 1), but is calcu‐ - lated by counting to clock cycles to complete an instruction. - Only available for x86/amd64. - - - freq_dyn_g (n) - Returns CPU #n's frequency in GHz (defaults to 1), but is calcu‐ - lated by counting to clock cycles to complete an instruction. - Only available for x86/amd64. - - -======= ->>>>>>> cb4b914... Few misc doc related things.:README fs_bar (height),(width) fs - Bar that shows how much space is used on a file system. height + Bar that shows how much space is used on a file system. height is the height in pixels. fs is any file on that file system. @@ -1094,8 +1088,8 @@ conky(1) conky(1) if_running (process) - if PROCESS is running, display everything $if_running and the - matching $endif. This uses the ``pidof'' command, so the -x + if PROCESS is running, display everything $if_running and the + matching $endif. This uses the ``pidof'' command, so the -x switch is also supported. @@ -1105,8 +1099,8 @@ conky(1) conky(1) if_smapi_bat_installed (INDEX) - when using smapi, if the battery with index INDEX is installed, - display everything between $if_smapi_bat_installed and the + when using smapi, if the battery with index INDEX is installed, + display everything between $if_smapi_bat_installed and the matching $endif @@ -1116,17 +1110,17 @@ conky(1) conky(1) if_updatenr (updatenr) - If it's the UPDATENR-th time that conky updates, display every‐ + If it's the UPDATENR-th time that conky updates, display every‐ thing between $if_updatenr and the matching $endif. The counter - resets when the highest UPDATENR is reached. Example : + resets when the highest UPDATENR is reached. Example : "{$if_updatenr 1}foo$endif{$if_updatenr 2}bar$endif{$if_updatenr - 4}$endif" shows foo 25% of the time followed by bar 25% of the + 4}$endif" shows foo 25% of the time followed by bar 25% of the time followed by nothing the other half of the time. imap_messages (args) Displays the number of messages in your global IMAP inbox by de‐ - fault. You can define individual IMAP inboxes seperately by + fault. You can define individual IMAP inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 143, default interval is 5 minutes, and default number of re‐ @@ -1145,7 +1139,7 @@ conky(1) conky(1) ioscheduler disk - Prints the current ioscheduler used for the given disk name + Prints the current ioscheduler used for the given disk name (i.e. e.g. "hda" or "sdb") @@ -1163,8 +1157,8 @@ conky(1) conky(1) loadgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐ ent colour 2) (scale) - Load1 average graph, similar to xload, with optional colours in - hex, minus the #. Uses a logarithmic scale (to see small num‐ + Load1 average graph, similar to xload, with optional colours in + hex, minus the #. Uses a logarithmic scale (to see small num‐ bers) when you use "log" instead of "normal". @@ -1177,9 +1171,9 @@ conky(1) conky(1) mails (mailbox) (interval) - Mail count in the specified mailbox or your mail spool if not. - Both mbox and maildir type mailboxes are supported. You can use - a program like fetchmail to get mails from some server using + Mail count in the specified mailbox or your mail spool if not. + Both mbox and maildir type mailboxes are supported. You can use + a program like fetchmail to get mails from some server using your favourite protocol. See also new_mails. @@ -1189,32 +1183,32 @@ conky(1) conky(1) seen_mails (maildir) (interval) - Number of mails marked as seen in the specified mailbox or mail - spool if not. Only maildir type mailboxes are supported, mbox + Number of mails marked as seen in the specified mailbox or mail + spool if not. Only maildir type mailboxes are supported, mbox type will return -1. unseen_mails (maildir) (interval) - Number of new or unseen mails in the specified mailbox or mail - spool if not. Only maildir type mailboxes are supported, mbox + Number of new or unseen mails in the specified mailbox or mail + spool if not. Only maildir type mailboxes are supported, mbox type will return -1. flagged_mails (maildir) (interval) - Number of mails marked as flagged in the specified mailbox or - mail spool if not. Only maildir type mailboxes are supported, + Number of mails marked as flagged in the specified mailbox or + mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. unflagged_mails (maildir) (interval) - Number of mails not marked as flagged in the specified mailbox + Number of mails not marked as flagged in the specified mailbox or mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. forwarded_mails (maildir) (interval) - Number of mails marked as forwarded in the specified mailbox or - mail spool if not. Only maildir type mailboxes are supported, + Number of mails marked as forwarded in the specified mailbox or + mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. @@ -1225,33 +1219,33 @@ conky(1) conky(1) replied_mails (maildir) (interval) - Number of mails marked as replied in the specified mailbox or - mail spool if not. Only maildir type mailboxes are supported, + Number of mails marked as replied in the specified mailbox or + mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. unreplied_mails (maildir) (interval) - Number of mails not marked as replied in the specified mailbox + Number of mails not marked as replied in the specified mailbox or mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. draft_mails (maildir) (interval) Number of mails marked as draft in the specified mailbox or mail - spool if not. Only maildir type mailboxes are supported, mbox + spool if not. Only maildir type mailboxes are supported, mbox type will return -1. trashed_mails (maildir) (interval) - Number of mails marked as trashed in the specified mailbox or - mail spool if not. Only maildir type mailboxes are supported, + Number of mails marked as trashed in the specified mailbox or + mail spool if not. Only maildir type mailboxes are supported, mbox type will return -1. mboxscan (-n number of messages to print) (-fw from width) (-sw subject width) mbox - Print a summary of recent messages in an mbox format mailbox. - mbox parameter is the filename of the mailbox (can be encapsu‐ + Print a summary of recent messages in an mbox format mailbox. + mbox parameter is the filename of the mailbox (can be encapsu‐ lated using '"', ie. ${mboxscan -n 10 "/home/brenden/some box"} @@ -1262,22 +1256,18 @@ conky(1) conky(1) Bar that shows amount of memory in use -<<<<<<< HEAD:README memgauge (height),(width) Gauge that shows amount of memory in use (see cpugauge) memgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐ -======= - memgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐ ->>>>>>> cb4b914... Few misc doc related things.:README ent colour 2) (scale) - Memory usage graph. Uses a logarithmic scale (to see small num‐ + Memory usage graph. Uses a logarithmic scale (to see small num‐ bers) when you use "log" instead of "normal". memeasyfree - Amount of free memory including the memory that is very easily + Amount of free memory including the memory that is very easily freed (buffers/cache) @@ -1293,39 +1283,39 @@ conky(1) conky(1) mixer (device) - Prints the mixer value as reported by the OS. Default mixer is - "vol", but you can specify one of the following optional argu‐ + Prints the mixer value as reported by the OS. Default mixer is + "vol", but you can specify one of the following optional argu‐ ments: "vol", "bass", "treble", "synth", "pcm", "speaker", - "line", "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", + "line", "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", "line1", "line2", "line3", "dig1", "dig2", "dig3", "phin", "phout", "video", "radio", "monitor". Refer to the definition of - SOUND_DEVICE_NAMES in (on Linux), (on Linux), (on OpenBSD), or to find the exact op‐ tions available on your system. mixerbar (device) - Displays mixer value in a bar as reported by the OS. See docs + Displays mixer value in a bar as reported by the OS. See docs for $mixer for details on arguments. mixerr (device) - Prints the right channel mixer value as reported by the OS. See + Prints the right channel mixer value as reported by the OS. See docs for $mixer for details on arguments. mixerrbar (device) - Displays the right channel mixer value in a bar as reported by + Displays the right channel mixer value in a bar as reported by the OS. See docs for $mixer for details on arguments. mixerl (device) - Prints the left channel mixer value as reported by the OS. See + Prints the left channel mixer value as reported by the OS. See docs for $mixer for details on arguments. mixerlbar (device) - Displays the left channel mixer value in a bar as reported by + Displays the left channel mixer value in a bar as reported by the OS. See docs for $mixer for details on arguments. @@ -1447,12 +1437,12 @@ conky(1) conky(1) if_mpd_playing - if mpd is playing or paused, display everything between + if mpd is playing or paused, display everything between $if_mpd_playing and the matching $endif nameserver (index) - Print a nameserver from /etc/resolv.conf. Index starts at and + Print a nameserver from /etc/resolv.conf. Index starts at and defaults to 0. @@ -1461,8 +1451,8 @@ conky(1) conky(1) nvidia threshold temp ambient gpufreq memfreq imagequality - Nvidia graficcard support for the XNVCtrl library. Each option - can be shortened to the least significant part. Temperatures + Nvidia graficcard support for the XNVCtrl library. Each option + can be shortened to the least significant part. Temperatures are printed as float, all other values as integer. threshold: the thresholdtemperature at which the gpu slows down @@ -1480,25 +1470,25 @@ conky(1) conky(1) pb_battery item If running on Apple powerbook/ibook, display information on bat‐ - tery status. The item parameter specifies, what information to + tery status. The item parameter specifies, what information to display. Exactly one item must be specified. Valid items are: status: Display if battery is fully charged, charging, discharg‐ ing or absent (running on AC) - percent: Display charge of battery in percent, if charging or - discharging. Nothing will be displayed, if battery is fully + percent: Display charge of battery in percent, if charging or + discharging. Nothing will be displayed, if battery is fully charged or absent. time: Display the time remaining until the battery will be fully - charged or discharged at current rate. Nothing is displayed, if - battery is absent or if it's present but fully charged and not + charged or discharged at current rate. Nothing is displayed, if + battery is absent or if it's present but fully charged and not discharging. platform (dev) type n - Platform sensor from sysfs (Linux 2.6). Parameter dev may be - omitted if you have only one platform device. Platform type is - either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' - meaning temperature. Parameter n is number of the sensor. See + Platform sensor from sysfs (Linux 2.6). Parameter dev may be + omitted if you have only one platform device. Platform type is + either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' + meaning temperature. Parameter n is number of the sensor. See /sys/bus/platform/devices/ on your local computer. @@ -1513,13 +1503,13 @@ conky(1) conky(1) pop3_used (args) - Displays the amount of space (in MiB, 2^20) used in your global - POP3 inbox by default. You can define individual POP3 inboxes - seperately by passing arguments to this object. Arguments are: - "host user pass [-i interval] [-p port] [-e command] [-r re‐ + Displays the amount of space (in MiB, 2^20) used in your global + POP3 inbox by default. You can define individual POP3 inboxes + seperately by passing arguments to this object. Arguments are: + "host user pass [-i interval] [-p port] [-e command] [-r re‐ tries]". Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If the password - is supplied as '*', you will be prompted to enter the password + is supplied as '*', you will be prompted to enter the password when Conky starts. @@ -1537,14 +1527,14 @@ conky(1) conky(1) scroll length (step) text - Scroll 'text' by 'step' characters showing 'length' number of - characters at the same time. The text may also contain vari‐ + Scroll 'text' by 'step' characters showing 'length' number of + characters at the same time. The text may also contain vari‐ ables. 'step' is optional and defaults to 1 if not set. If a var - creates output on multiple lines then the lines are placed be‐ - hind each other separated with a '|'-sign. Do NOT use vars that - change colors or otherwise affect the design inside a scrolling - text. If you want spaces between the start and the end of - 'text', place them at the end of 'text' not at the front ("foo‐ + creates output on multiple lines then the lines are placed be‐ + hind each other separated with a '|'-sign. Do NOT use vars that + change colors or otherwise affect the design inside a scrolling + text. If you want spaces between the start and the end of + 'text', place them at the end of 'text' not at the front ("foo‐ bar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo"). @@ -1554,35 +1544,35 @@ conky(1) conky(1) smapi (ARGS) - when using smapi, display contents of the /sys/devices/plat‐ - form/smapi directory. ARGS are either '(FILENAME)' or 'bat (IN‐ - DEX) (FILENAME)' to display the corresponding files' content. - This is a very raw method of accessing the smapi values. When + when using smapi, display contents of the /sys/devices/plat‐ + form/smapi directory. ARGS are either '(FILENAME)' or 'bat (IN‐ + DEX) (FILENAME)' to display the corresponding files' content. + This is a very raw method of accessing the smapi values. When available, better use one of the smapi_* variables instead. smapi_bat_bar (INDEX),(height),(width) - when using smapi, display the remaining capacity of the battery + when using smapi, display the remaining capacity of the battery with index INDEX as a bar. smapi_bat_perc (INDEX) - when using smapi, display the remaining capacity in percent of - the battery with index INDEX. This is a separate variable be‐ + when using smapi, display the remaining capacity in percent of + the battery with index INDEX. This is a separate variable be‐ cause it supports the 'use_spacer' configuration option. smapi_bat_power INDEX - when using smapi, display the current power of the battery with - index INDEX in watt. This is a separate variable because the - original read out value is being converted from mW. The sign of - the output reflects charging (positive) or discharging (nega‐ + when using smapi, display the current power of the battery with + index INDEX in watt. This is a separate variable because the + original read out value is being converted from mW. The sign of + the output reflects charging (positive) or discharging (nega‐ tive) state. smapi_bat_temp INDEX when using smapi, display the current temperature of the battery - with index INDEX in degree Celsius. This is a separate variable + with index INDEX in degree Celsius. This is a separate variable because the original read out value is being converted from mil‐ li degree Celsius. @@ -1627,36 +1617,36 @@ conky(1) conky(1) The connection index provides you with access to each connection in the port monitor. The monitor will return information for in‐ dex values from 0 to n-1 connections. Values higher than n-1 are - simply ignored. For the "count" item, the connection index must + simply ignored. For the "count" item, the connection index must be omitted. It is required for all other items. Examples: - ${tcp_portmon 6881 6999 count} - displays the number of connec‐ + ${tcp_portmon 6881 6999 count} - displays the number of connec‐ tions in the bittorrent port range - ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the + ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the first sshd connection - ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the + ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the tenth sshd connection ${tcp_portmon 1 1024 rhost 0} - displays the remote host name of the first connection on a privileged port ${tcp_portmon 1 1024 rport 4} - displays the remote host port of the fifth connection on a privileged port - ${tcp_portmon 1 65535 lservice 14} - displays the local service + ${tcp_portmon 1 65535 lservice 14} - displays the local service name of the fifteenth connection in the range of all ports Note that port monitor variables which share the same port range actually refer to the same monitor, so many references to a sin‐ gle port range for different items and different indexes all use - the same monitor internally. In other words, the program avoids + the same monitor internally. In other words, the program avoids creating redundant monitors. texeci interval command - Runs a command at an interval inside a thread and displays the - output. Same as $execi, except the command is run inside a - thread. Use this if you have a slow script to keep Conky updat‐ - ing. You should make the interval slightly longer then the time - it takes your script to execute. For example, if you have a - script that take 5 seconds to execute, you should make the in‐ + Runs a command at an interval inside a thread and displays the + output. Same as $execi, except the command is run inside a + thread. Use this if you have a slow script to keep Conky updat‐ + ing. You should make the interval slightly longer then the time + it takes your script to execute. For example, if you have a + script that take 5 seconds to execute, you should make the in‐ terval at least 6 seconds. See also $execi. @@ -1664,18 +1654,11 @@ conky(1) conky(1) Move text over by N pixels. See also $voffset. -<<<<<<< HEAD:README rss url delay_in_minutes action (num_par (spaces_in_front)) Download and parse RSS feeds. Action may be one of the follow‐ ing: feed_title, item_title (with num par), item_desc (with num par) and item_titles (when using this action and spaces_in_front is given conky places that many spaces in front of each item). -======= - rss url delay_in_minutes action item_num - Download and parse RSS feeds. Action may be one of the follow‐ - ing: feed_title, item_title (with num par), item_desc (with num - par) and item_titles. ->>>>>>> cb4b914... Few misc doc related things.:README tab (width, (start)) diff --git a/doc/config_settings.xml b/doc/config_settings.xml index 52ae916..4d46c0b 100644 --- a/doc/config_settings.xml +++ b/doc/config_settings.xml @@ -16,21 +16,21 @@ - Boolean value, if true, Conky will be forked to background when started + Boolean value, if true, Conky will be forked to background when started. - Border margin in pixels + Border margin in pixels. - Border width in pixels + Border width in pixels. @@ -44,7 +44,14 @@ - The number of samples to average for CPU monitoring + The number of samples to average for CPU monitoring. + + + + + + + The number of samples to average for disk I/O monitoring. @@ -58,7 +65,7 @@ - Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments + Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments. diff --git a/doc/conky.1 b/doc/conky.1 index abe07fd..69b3202 100644 --- a/doc/conky.1 +++ b/doc/conky.1 @@ -155,15 +155,15 @@ Aligned position on screen, may be top_left, top_right, top_middle, bottom_left, .TP \fB\*(T<\fBbackground\fR\*(T>\fR -Boolean value, if true, Conky will be forked to background when started +Boolean value, if true, Conky will be forked to background when started. .TP \fB\*(T<\fBborder_margin\fR\*(T>\fR -Border margin in pixels +Border margin in pixels. .TP \fB\*(T<\fBborder_width\fR\*(T>\fR -Border width in pixels +Border width in pixels. .TP \fB\*(T<\fBcolorN\fR\*(T>\fR @@ -171,7 +171,11 @@ Predefine a color for use inside TEXT segments. Substitute N by a digit between .TP \fB\*(T<\fBcpu_avg_samples\fR\*(T>\fR -The number of samples to average for CPU monitoring +The number of samples to average for CPU monitoring. + +.TP +\fB\*(T<\fBdiskio_avg_samples\fR\*(T>\fR +The number of samples to average for disk I/O monitoring. .TP \fB\*(T<\fBtop_cpu_separate\fR\*(T>\fR @@ -179,7 +183,7 @@ If true, cpu in top will show usage of one processor's power. If false, cpu in t .TP \fB\*(T<\fBdefault_bar_size\fR\*(T>\fR -Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments +Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments. .TP \fB\*(T<\fBdefault_graph_size\fR\*(T>\fR @@ -603,10 +607,10 @@ Change drawing color to color Change drawing color to colorN configuration option, where N is a digit between 0 and 9, inclusively. .TP -\fB\*(T<\fBcombine\fR\*(T>\fR \*(T<\fBvar1 var2\fR\*(T> +\fB\*(T<\fBcombine\fR\*(T>\fR \*(T<\fBvar1 var2\fR\*(T> Places the lines of var2 to the right of the lines of var1 seperated by the chars that are put between var1 and var2. For example: ${combine ${head /proc/cpuinfo 2} - ${head /proc/meminfo 1}} gives as output "cpuinfo_line1 - meminfo_line1" on line 1 and "cpuinfo_line2 -" on line 2. $combine vars can also be nested to place more vars next to each other. -.TP +.TP \fB\*(T<\fBconky_version\fR\*(T>\fR Conky version diff --git a/src/conky.c b/src/conky.c index b20204a..13ae965 100644 --- a/src/conky.c +++ b/src/conky.c @@ -262,7 +262,7 @@ static unsigned long total_run_times; /* fork? */ static int fork_to_background; -static int cpu_avg_samples, net_avg_samples; +static int cpu_avg_samples, net_avg_samples, diskio_avg_samples; /* filenames for output */ char *overwrite_file = NULL; FILE *overwrite_fpointer = NULL; @@ -6534,6 +6534,7 @@ static void set_default_configurations(void) total_run_times = 0; info.cpu_avg_samples = 2; info.net_avg_samples = 2; + info.diskio_avg_samples = 2; info.memmax = 0; top_cpu = 0; cpu_separate = 0; @@ -6934,6 +6935,18 @@ static void load_config_file(const char *f) CONF_ERR; } } + CONF("diskio_avg_samples") { + if (value) { + diskio_avg_samples = strtol(value, 0, 0); + if (diskio_avg_samples < 1 || diskio_avg_samples > 14) { + CONF_ERR; + } else { + info.diskio_avg_samples = diskio_avg_samples; + } + } else { + CONF_ERR; + } + } #ifdef HAVE_XDBE CONF("double_buffer") { diff --git a/src/conky.h b/src/conky.h index 002ae9f..dda42c5 100644 --- a/src/conky.h +++ b/src/conky.h @@ -229,6 +229,8 @@ struct information { unsigned int net_avg_samples; + unsigned int diskio_avg_samples; + float loadavg[3]; struct mail_s *mail; diff --git a/src/diskio.c b/src/diskio.c index 69dafdd..6a53a07 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -52,6 +52,9 @@ * also containing the totals. */ static struct diskio_stat stats = { .next = NULL, + .sample = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + .sample_read = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + .sample_write = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, .current = 0, .current_read = 0, .current_write = 0, @@ -98,19 +101,40 @@ struct diskio_stat *prepare_diskio_stat(const char *s) static void update_diskio_values(struct diskio_stat *ds, unsigned int reads, unsigned int writes) { + int i; + double sum=0, sum_r=0, sum_w=0; + if (reads < ds->last_read || writes < ds->last_write) { /* counter overflow or reset - rebase to sane values */ - ds->last = 0; - ds->last_read = 0; - ds->last_write = 0; + ds->last = reads+writes; + ds->last_read = reads; + ds->last_write = writes; } /* since the values in /proc/diskstats are absolute, we have to substract * our last reading. The numbers stand for "sectors read", and we therefore * have to divide by two to get KB */ - ds->current_read = (reads - ds->last_read) / 2; - ds->current_write = (writes - ds->last_write) / 2; - ds->current = ds->current_read + ds->current_write; + ds->sample_read[0] = (reads - ds->last_read) / 2; + ds->sample_write[0] = (writes - ds->last_write) / 2; + ds->sample[0] = ds->sample_read[0] + ds->sample_write[0]; + + /* compute averages */ + for (i = 0; i < (signed) info.diskio_avg_samples; i++) { + sum += ds->sample[i]; + sum_r += ds->sample_read[i]; + sum_w += ds->sample_write[i]; + } + ds->current = sum / (double) info.diskio_avg_samples; + ds->current_read = sum_r / (double) info.diskio_avg_samples; + ds->current_write = sum_w / (double) info.diskio_avg_samples; + + /* shift sample history */ + for (i = info.diskio_avg_samples-1; i > 0; i--) { + ds->sample[i] = ds->sample[i-1]; + ds->sample_read[i] = ds->sample_read[i-1]; + ds->sample_write[i] = ds->sample_write[i-1]; + } + /* save last */ ds->last_read = reads; ds->last_write = writes; ds->last = ds->last_read + ds->last_write; @@ -125,7 +149,7 @@ void update_diskio(void) char buf[512], devbuf[64]; unsigned int major, minor; unsigned int reads, writes; - unsigned int total_reads, total_writes; + unsigned int total_reads=0, total_writes=0; int col_count = 0; stats.current = 0; @@ -146,7 +170,7 @@ void update_diskio(void) * * XXX: ignore devices which are part of a SW RAID (MD_MAJOR) */ if (col_count == 5 && major != LVM_BLK_MAJOR && major != NBD_MAJOR - && major != RAMDISK_MAJOR && major != LOOP_MAJOR) { + && major != RAMDISK_MAJOR && major != LOOP_MAJOR && minor==0) { total_reads += reads; total_writes += writes; } else { diff --git a/src/diskio.h b/src/diskio.h index ed987c8..0cc9003 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -32,12 +32,15 @@ struct diskio_stat { struct diskio_stat *next; char *dev; - unsigned int current; - unsigned int current_read; - unsigned int current_write; - unsigned int last; - unsigned int last_read; - unsigned int last_write; + double sample[15]; + double sample_read[15]; + double sample_write[15]; + double current; + double current_read; + double current_write; + double last; + double last_read; + double last_write; }; struct diskio_stat *prepare_diskio_stat(const char *s); -- 1.7.9.5