Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0a157b1
Add a platform for Performance Co-Pilot (PCP) metrics
natoscott Feb 17, 2021
5fe1860
Add new CI workflow to check pcp-enabled builds
natoscott Feb 17, 2021
26e85d3
Fix cut+paste typo in --enable-pcp error message
natoscott Feb 19, 2021
d3dda29
Add ZFS ARC statistics and meters to the PCP platform
smalinux Feb 22, 2021
7e5d24e
Fix PCP ZramMeter in presense of missing zram metrics
smalinux Feb 22, 2021
6f2f3f4
Ensure PCP platform ZramMeter always uses initialized data
natoscott Feb 22, 2021
9978e43
Fixes and cleanups for ZFS Meters and metrics
natoscott Feb 22, 2021
7003a98
Update PCP platform to match latest API changes
natoscott Mar 5, 2021
2beb376
Update PCP platform to use the old hostname API call
natoscott Mar 5, 2021
7b95885
Implement shared memory support on the PCP platform
natoscott Mar 16, 2021
ee90997
Implement command line and environment handling for pcp htop.
natoscott Mar 25, 2021
4971253
Add time handling interfaces for the pcp platform
natoscott Apr 8, 2021
5be45a1
Drop CI distcheck on pcp build as pcp-htop.c now contains main
natoscott Apr 8, 2021
6ae96c0
Remove dynamic allocation of PCP metric atomvalues expansion
natoscott Apr 8, 2021
229109e
Resolve some Coverity scan misfires in PCP platform code
natoscott Apr 8, 2021
18c0d3f
Various code tidyups based on review commentary from BenBE
natoscott Apr 14, 2021
b8ddc41
Rework TTY column for the PCP platform
natoscott Apr 14, 2021
7538a52
Update the PCP platform to use common Process fields and code
natoscott May 27, 2021
591fc78
Update platform-specific header includes to use pcp paths.
natoscott Jun 7, 2021
7653e15
Use macros to PCPProcessList value extraction, tweak configure.ac
natoscott Jun 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ jobs:
- name: Distcheck
run: make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-static --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --disable-hwloc --disable-delayacct --enable-sensors --enable-capabilities'

build-ubuntu-latest-pcp:
# Turns out 'ubuntu-latest' can be older than 20.04, we want PCP v5+
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: sudo apt-get install libpcp3-dev libncursesw5-dev libtinfo-dev libgpm-dev
- name: Bootstrap
run: ./autogen.sh
- name: Configure
# Until Ubuntu catches up with pcp-5.2.3+, cannot use -werror due to:
# passing argument 2 of ‘pmLookupName’ from incompatible pointer type
run: ./configure --enable-pcp --enable-unicode
- name: Build
run: make -k

build-ubuntu-latest-clang-analyzer:
runs-on: ubuntu-latest
env:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# the binary:
# the binaries:
htop
pcp-htop

# all object files
*.o
Expand Down
34 changes: 32 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ myhtopsources = \
Hashtable.c \
Header.c \
HostnameMeter.c \
htop.c \
IncSet.c \
InfoScreen.c \
ListItem.c \
Expand Down Expand Up @@ -328,6 +327,37 @@ myhtopplatheaders = $(solaris_platform_headers)
myhtopplatsources = $(solaris_platform_sources)
endif

# Performance Co-Pilot (PCP)
# --------------------------

pcp_platform_headers = \
pcp/PCPProcess.h \
pcp/PCPProcessList.h \
pcp/Platform.h \
pcp/ProcessField.h \
linux/PressureStallMeter.h \
linux/ZramMeter.h \
linux/ZramStats.h \
zfs/ZfsArcMeter.h \
zfs/ZfsArcStats.h \
zfs/ZfsCompressedArcMeter.h

pcp_platform_sources = \
pcp/PCPProcess.c \
pcp/PCPProcessList.c \
pcp/Platform.c \
linux/PressureStallMeter.c \
linux/ZramMeter.c \
zfs/ZfsArcMeter.c \
zfs/ZfsCompressedArcMeter.c

if HTOP_PCP
myhtopplatprogram = pcp-htop
myhtopplatheaders = $(pcp_platform_headers)
myhtopplatsources = $(pcp_platform_sources)
pcp_htop_SOURCES = $(myhtopplatprogram).c $(myhtopheaders) $(myhtopplatheaders) $(myhtopsources) $(myhtopplatsources)
endif

# Unsupported
# -----------

Expand All @@ -353,7 +383,7 @@ endif
# ----

bin_PROGRAMS = $(myhtopplatprogram)
htop_SOURCES = $(myhtopheaders) $(myhtopplatheaders) $(myhtopsources) $(myhtopplatsources)
htop_SOURCES = $(myhtopplatprogram).c $(myhtopheaders) $(myhtopplatheaders) $(myhtopsources) $(myhtopplatsources)
nodist_htop_SOURCES = config.h

target:
Expand Down
26 changes: 26 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@ esac

# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# Checks for a PCP-based htop build. (https://pcp.io)
# ----------------------------------------------------------------------

AC_ARG_ENABLE([pcp],
[AS_HELP_STRING([--enable-pcp],
[build a pcp-htop binary @<:@default=no@:>@])],
[],
[enable_pcp=no])
case "$enable_pcp" in
no)
;;
yes)
AC_CHECK_HEADERS([pcp/pmapi.h], [my_htop_platform=pcp],
[AC_MSG_ERROR([can not find PCP header file])])
AC_SEARCH_LIBS([pmNewContext], [pcp], [], [AC_MSG_ERROR([can not find PCP library])])
AC_DEFINE([HTOP_PCP], [1], [Define if building pcp-htop binary.])
;;
*)
AC_MSG_ERROR([bad value '$enable_pcp' for --enable-pcp option])
;;
esac

# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Checks for generic header files.
Expand Down Expand Up @@ -608,6 +633,7 @@ AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd])
AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd])
AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin])
AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris])
AM_CONDITIONAL([HTOP_PCP], [test "$my_htop_platform" = pcp])
AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported])

AC_SUBST(my_htop_platform)
Expand Down
26 changes: 26 additions & 0 deletions pcp-htop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
htop - pcp-htop.c
(C) 2004-2011 Hisham H. Muhammad
(C) 2020-2021 htop dev team
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/

#include "config.h" // IWYU pragma: keep

#include <pcp/pmapi.h>

#include "CommandLine.h"
#include "Platform.h"


int main(int argc, char** argv) {
const char* name = "pcp-htop";
pmSetProgname(name);

/* extract environment variables */
opts.flags |= PM_OPTFLAG_ENV_ONLY;
(void)pmGetOptions(argc, argv, &opts);

return CommandLine_run(name, argc, argv);
}
Loading