Skip to content

Add a platform for Performance Co-Pilot (PCP) metrics#536

Closed
natoscott wants to merge 20 commits intohtop-dev:masterfrom
natoscott:pcp-platform
Closed

Add a platform for Performance Co-Pilot (PCP) metrics#536
natoscott wants to merge 20 commits intohtop-dev:masterfrom
natoscott:pcp-platform

Conversation

@natoscott
Copy link
Copy Markdown
Member

This introduces a htop 'platform' for extracting metrics using the PCP performance metrics API - PMAPI(3). It can be used via the --enable-pcp=yes configure option.

So far I've added support for live localhost metrics only, and only using pre-defined metrics already found in htop. If available, all sampling is performed by pmcd(1) - else, we fallback to htop doing the metric sampling itself (all handled below the PMAPI interfaces used here). When pmcd is used, it's usually run children with elevated privileges so this htop platform does not ever need to be setuid, nor does htop itself need to run as root (authentication with pmcd is available).

Additionally, the PMAPI allows us to support archives for historical analysis and for automated regression tests in htop. We'll need platform-specific command line argument additions, which isn't yet feasible in htop (not difficult to add though).

The goal of this first version is minimal impact in terms of modifying the htop code base, to introduce key ideas in PCP (metric namespace, metadata, APIs and so on) and give us something to discuss, experiment with and build on.

@BenBE BenBE added the feature request Completely new feature requested label Feb 17, 2021
@BenBE BenBE added this to the 3.0.6 milestone Feb 17, 2021
@BenBE BenBE added the needs-discussion 🤔 Changes need to be discussed and require consent label Feb 17, 2021
@BenBE BenBE removed this from the 3.0.6 milestone Feb 17, 2021
Comment thread configure.ac Outdated
natoscott added a commit to natoscott/htop that referenced this pull request Mar 17, 2021
The libcap code is Linux-specific so move it all below
the linux/ platform subdirectory.  As this feature has
custom command-line long options I provide a mechanism
whereby each platform can add custom long options that
augment the main htop options.  We'll make use this of
this with the pcp/ platform in due course to implement
the --host and --archive options there.

Related to htop-dev#536
@natoscott natoscott removed the needs-discussion 🤔 Changes need to be discussed and require consent label Mar 17, 2021
natoscott added a commit to natoscott/htop that referenced this pull request Mar 22, 2021
The libcap code is Linux-specific so move it all below
the linux/ platform subdirectory.  As this feature has
custom command-line long options I provide a mechanism
whereby each platform can add custom long options that
augment the main htop options.  We'll make use this of
this with the pcp/ platform in due course to implement
the --host and --archive options there.

Related to htop-dev#536
@BenBE BenBE added the PCP PCP related issues label Mar 23, 2021
natoscott added a commit to natoscott/htop that referenced this pull request Mar 23, 2021
One review request relating to the PCP platform is to have
a clearly separate binary from the regular htop so that we
have no confusion as to what is being requested to run, to
aid debugging, and a bunch of other good reasons.

This commit renames htop.c to CommandLine.c and provides a
minimal htop main function for 'native' platforms to use.
The PCP version of this will setup libpcp.so and then call
the same CommandLine_run function as regular htop.

Related to htop-dev#536
natoscott added a commit to natoscott/htop that referenced this pull request Mar 23, 2021
One review request relating to the PCP platform is to have
a clearly separate binary from the regular htop so that we
have no confusion as to what is being requested to run, to
aid debugging, and a bunch of other good reasons.

This commit renames htop.c to CommandLine.c and provides a
minimal htop main function for 'native' platforms to use.
The PCP version of this will setup libpcp.so and then call
the same CommandLine_run function as regular htop.

Related to htop-dev#536
natoscott added a commit to natoscott/htop that referenced this pull request Mar 25, 2021
One review request relating to the PCP platform is to have
a clearly separate binary from the regular htop so that we
have no confusion as to what is being requested to run, to
aid debugging, and a bunch of other good reasons.

This commit renames htop.c to CommandLine.c and provides a
minimal htop main function for 'native' platforms to use.
The PCP version of this will setup libpcp.so and then call
the same CommandLine_run function as regular htop.

Related to htop-dev#536
Comment thread configure.ac Outdated
Comment thread pcp/Platform.h
Comment thread pcp/Platform.h
Comment thread pcp/PCPProcessList.h
Comment thread pcp/PCPProcessList.h Outdated
Comment thread pcp/Platform.c Outdated
Comment thread pcp/Platform.c
Comment thread pcp/Platform.c Outdated
Comment thread pcp/Platform.c
Comment thread pcp/Platform.c Outdated
@natoscott natoscott force-pushed the pcp-platform branch 3 times, most recently from f9789a5 to 14b67a3 Compare April 14, 2021 23:03
natoscott and others added 8 commits May 27, 2021 16:06
This introduces an initial platform for extracting metrics
using the PCP performance metrics API - PMAPI(3).  It can
be used via the --enable-pcp=yes configure option.

So far I've added support for live localhost metrics only,
and only using pre-defined metrics already found in htop.
If available, all sampling is performed by pmcd(1) - else,
we fallback to htop doing the metric sampling itself (all
below the PMAPI).  When pmcd is used, it may be configured
to run children with elevated privileges, so htop does not
need to be setuid (authentication with pmcd is available).

Additionally, the PMAPI allows us to support archives (for
historical analysis and for automated regression tests in
htop).  We'll need platform-specific command line argument
additions, which isn't yet feasible in htop (not difficult
to add though).

The goal of this first version is minimal impact in terms
of modifying the htop codebase, to introduce key ideas in
PCP (metric namespace, metadata, APIs and so on) and give
us something to discuss, experiment with and build on.
Updates for recent NetworkIO Meter changes, adds support
for the SysArch and HostName Meters.  The SysArch change
is based on work originally by Sohaib Mohamed.
Resolves a couple of remaining review notes from @BenBE.
Comment thread configure.ac Outdated
Comment thread pcp/PCPProcessList.c Outdated
Comment thread pcp/PCPProcessList.c Outdated
Comment thread pcp/PCPProcessList.c Outdated
Comment thread pcp/PCPProcessList.c Outdated
Resolves a couple of remaining review notes from @BenBE.
@natoscott
Copy link
Copy Markdown
Member Author

Merged.

@natoscott natoscott closed this Jun 9, 2021
@natoscott natoscott deleted the pcp-platform branch July 8, 2021 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Completely new feature requested PCP PCP related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants