Age | Commit message (Collapse) | Author | Files | Lines |
|
Since get_number_cpus() now returns unsigned int store it's return value
and derived values in unsigned int variables as well.
This fixes the some warnings when compiling with -W/-Wsign-compare:
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Those are fixes for the following warnings:
pcap_mm.c:119:29: warning: Using plain integer as NULL pointer
pcap_mm.c:141:29: warning: Using plain integer as NULL pointer
ring.c:24:31: warning: Using plain integer as NULL pointer
flowtop.c:1114:22: warning: Using plain integer as NULL pointer
ifpps.c:1133:29: warning: Using plain integer as NULL pointer
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Make this conform to trafgen/netsniff-ng and reduce it to 1 line
description.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The stack trace of valgrind --leak-check=full --show-reachable=yes ifpps \
-lpcd wlan0 showed that at exit members from stats are still reachable.
They have been alloced through stats_alloc, but not freed.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
It is possible to use a interval even of 0, although it would not
really make sense. It's not a bug either, so throw a warning to the
user in that case on 1Gbit/s.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
ifpps always reported the same values for median as for average in the
CPU load fields (usr, sys, idle, iowait). This is of course incorrect.
The bug was due to 3 sub-problems:
- Summing up long double values (m_cpu_*) in an uint64_t (all)
- Not using %Lf (for long double) in mvwprintw()
- Explicitely use floating point division in MEDIAN_EVEN
Fix the bug by summing up in a separate accumulator of type long double,
use the correct format string for long double and divide by 2.0 in
MEDIAN_EVEN to force the result to be (long) double.
Reported-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of (more or less) arbitrarily listing the command line options,
sort them according to the following rule:
- options with required argument, alphabetically by short option
- options without argument, alphabetically by short option
- common options -v/--version and -h/--help
Do this in the short options string, the long options struct, the
in-program usage and the man page.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add whitespace padding in one occurence of 'med:' output.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This was missing in commit 971b1d95 ("ifpps: Optionally display median
values for CPU load and interrupts"). Update the usage to reflect the
changes too.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Using the -m/--median command line option, median values across all CPUs
are displayed for CPU load, interrupts per interval, sw interrupts per
interval and absolute number of interrupts.
Also update the manpage accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
When running ifpps on systems with 16, 32 or more CPUs, 'avg:...'
field is not being padded with witespaces as the rest of the CPU
lines. This patch does that.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Collecting device statistics on high speed every second can be very
costly, so warn about this in ncurses mode.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
In Fedora or RHEL/CentOS releases the machine type is already part
of the package name, so show it only, if it does not appear there.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Lets make the headline output a bit more useful and show the current
kernel version and well as the machine/hardware type.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
If will now look like the following:
cpu6 +: 237357 irqs
cpu2 |: 117538 irqs
cpu0 |: 8419 irqs
cpu7 |: 4523 irqs
cpu5 |: 4312 irqs
cpu1 -: 1432 irqs
avg: 47606.8
This makes it a bit more precise/intuitive that we sort from max
to min.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
In order to get a better overview, lets align the avg numbers to the
other shown decimals. However, for this we would need to remove the
avg units as we deal with floats here. But we know the units from the
above numbers anyway. I think this makes it more clear to follow.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Just a whitespace fix to align the strings to the fmt string.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
stats_avg will be reset to 0 on the first call to stats_top() before
displaying any results, thus this memset() is not necessary.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Remove trailing whitespace where they're not necessary for the
background to extend beyond the text. Replace whitespaces needed for
tabbing by setting the appropriate format string field width modifiers.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Since we now also display the average (and in the future possibly also
the standard deviation), reduce the default number of CPUs displayed to
5, to keep terminal space usage low.
Suggested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Calculate the average for CPU usage, IRQs/t and absolute IRQs across all
CPUs (also the ones which are not displayed) and show them below the
respective per-CPU values.
Mention this fact the man page accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In order to be able to better track regressions or to give support,
let us track the Git id as well in version information. This makes
the ``--version'' switch actually useful.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
ncurses (de-)initialization is duplicated across flowtop and ifpps, so
move it to an own module and use it from both tools.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We never use or report it anywhere, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Since we've added '+'/'-' for max/min CPU values, we also need to shift
once whitespace to the left to properly align ncurses display again.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This is not the top number of CPUs but the total number. Rename the
variable to not confuse this.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of just giving the percentage of memory usage, report the total,
used, active and inactive memory values. Also report total, free and
cached for swap.
Instead of reporting the memory in the 'sys' line add two new lines for
these reports and use the free space to report the total number of
processes.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
These stats values are not reported anywhere in relative terms, so it
makes no sense to calculate the difference for them.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
It's sufficient to calculate the difference of tx_bytes only once.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In case we add new stats values, j might be higher already when entering
the loop. As j will have the proper number anyway, there is no point in
re-initializing.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Also display the least heavy hitter for the relative and absolute IRQ
list. Also check that the number passed with -n is actually 1 or larger.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Along with the topmost heavy hitters, we always display the least heavy
hitter (unless there's only 1 CPU). This is not influenced by the -n
command line parameter, so also display the according additional CPU in
the header line.
Also update the manpage accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Finally eliminate xutils.{c,h} and move the rest to epoll2.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add an extra file for signal handling functions.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Same here as usual, break out link functions from xutils.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Move those functions out so that they can be more easily maintained
in its separate file.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Put them separately for the sake of maintanence.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Rename xio to ioops (io-ops) and boil its include files down to a
minimum.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Break this out so that we only need to have sigint non-static where
it is really needed.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
To make it more clear whether we're using the total number of CPUs or
the top number (default 10 or specified by user), rename the variable,
where the top number is used.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of hard-coding the maximum number of top hitter CPUs, allow the
user to set it manually using a command line option. The default value
(if no command line parameter is specified) remains at 10.
Also update the manpage accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Avoid code duplication by allocating the stats arrays dependent on the
number of CPUs in main() rather than screen_main() and term_main().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Introduced by commit 0e47d1d5011f ("ifpps: Don't assume a maximum of
32 CPUs"). Also update term_main with initial allocation of CPU data.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The dynamically allocated members of struct ifstat have an entry for
each CPU. Properly consider this when resetting the stats in the
STATS_ZERO1 macro.
Reported-by: Daniel Borkmann <borkmann@iogearbox.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
/proc/interrupts can have such a structure ...
98: 35 0 2902361 PCI-MSI-X eth1-0
106: 61 11 3841 PCI-MSI-X eth1-1
114: 28 0 61452 PCI-MSI-X eth1-2
122: 24 1586 22 PCI-MSI-X eth1-3
130: 2912 0 337 PCI-MSI-X eth1-4
138: 21 0 28 PCI-MSI-X eth1-5
146: 21 0 56 PCI-MSI-X eth1-6
154: 34 1 1 PCI-MSI-X eth1-7
... and will not count all IRQs for eth1-*. Thus change it to
sum up multiple entries.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Just a minor change to also show the total number of cpus in the
headline.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
It's not used anywhere anymore, so remove it.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The refresh interval can only be positive and is stored in an uint64_t,
so use strtoul() to convert it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|