Conversation
|
This pull request introduces 12 alerts when merging 1ee1e4c into 4f3ba68 - view on LGTM.com new alerts:
|
BenBE
left a comment
There was a problem hiding this comment.
Please fix all those fixme/todo comments.
Also what about having the Custom columns be handled as a sub-call to each platform's WriteColumn function? That way the overall public interface stays minimal.
98d2d91 to
2871e6d
Compare
|
This pull request introduces 8 alerts when merging 2871e6d into 4f3ba68 - view on LGTM.com new alerts:
|
67bcec4 to
c1efc01
Compare
c2145d4 to
b5db5bc
Compare
b5db5bc to
c793fa6
Compare
natoscott
left a comment
There was a problem hiding this comment.
Overall it looks good @smalinux - great work. I think the htoprc change mentioned elsewhere is a critical next step before this can be merged, and also the dynamic config tweaks I mention in the review.
I'll send through some more practical dynamic column configuration files shortly.
9d72b7a to
0a64972
Compare
0a64972 to
680196e
Compare
|
Exactly not. |
|
@natoscott not sure, but I think this related a476490, we need to do the same for columns. |
e50e350 to
dfa4b81
Compare
|
I'd prefer the following patch instead: $ git diff
diff --git a/Settings.c b/Settings.c
index 07158e6f..8b366849 100644
--- a/Settings.c
+++ b/Settings.c
@@ -391,7 +391,7 @@ int Settings_write(const Settings* this, bool onCrash) {
Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns) {
Settings* this = xCalloc(1, sizeof(Settings));
- this->dynamicColumns = dynamicColumns;
+ this->dynamicColumns = dynamicColumns ? dynamicColumns : Hashtable_new(1, true);
this->sortKey = PERCENT_CPU;
this->treeSortKey = PID;
this->direction = -1;Much cleaner, less complexity added and offers DiD for NULL-deref issues down the line … The current code for the dynamic columns isn't generally written to cope with |
b86f6d9 to
4695629
Compare
a0fefb6 to
cf6d0ff
Compare
BenBE
left a comment
There was a problem hiding this comment.
Things for follow-up cleanup:
- The column title alignment code may be updated to use a cache of previously aligned titles for columns. This should be done in conjunction with getting rid of the return of statically allocated module-global memory of those two functions.
- Check if
PCPDynamicColumnandPCPDynamicColumnscould utilizesize_tinstead ofunsigned intfor certain fields. - Split the PCP Metric API (functions
Metric_*) into their own module.
I'm probably missing something, but where's the Metric_enable(FOO, false) call for metrics being removed due to their column being removed in the settings?
I think if we're going this route, the Hashtable allocation should happen earlier (up in CommandLine.c). The allocated-but-empty table is not my preferred solution because its just wasting memory (ok, very small amount) for platforms lacking support - the NULL pointer approach feels slightly more efficient to me. Also if we allocate an empty hash for DynamicColumns we should probably do the same for DynamicMeters, for consistency there I guess.
There's not a huge number of accesses - I vote we just check for NULL and respond accordingly in each one that's missing the check. |
For reference, which source files/lines are you talking about there?
@smalinux do you want to hack on this?
I'll take these two items on. I'll do 'em as followup commits I think because they're likely to introduce patch conflicts with other PRs.
There isn't one - @smalinux do you know where that call would need to be? I figured it wasn't a big deal to keep sampling one or two metrics we're not using anymore after interactive changes, but we should switch 'em off if we can. |
|
@natoscott FYI: The minimalistic patch regarding I'd rather not follow the But I'm fine if you make the k, regarding header alignment and static buffers: I referred to |
OK, fair enough.
OK, let's go that route then.
Taa. |
|
6e16d21 to
a10c088
Compare
BenBE
left a comment
There was a problem hiding this comment.
LGTM. Didn't run it yet with those latest changes …
929f4e2 to
8173856
Compare
5f0b5d9 to
d671c54
Compare
Implements support for arbitrary Performance Co-Pilot metrics with per-process instance domains to form new htop columns. The column-to-metric mappings are setup using configuration files which will be documented via man pages as part of a follow-up commit. We provide an initial set of column configurations so as to provide new capabilities to pcp-htop: including configs for containers, open fd counts, scheduler run queue time, tcp/udp bytes/calls sent/recv, delay acct, virtual machine guests, detailed virtual memory, swap. Note there is a change to the configuration file path resolution algorithm introduced for 'dynamic meters'. First, look in any custom PCP_HTOP_DIR location. Then iterate, in priority order, users home directory, then local sysadmins files in /etc/pcp/htop, then readonly configuration files below /usr/share/pcp/htop. This final location becomes the preferred place for our own shipped meter and column files. The Settings file (htoprc) writing code is updated to not using the numeric identifier for dynamic columns. The same strategy used for dynamic meters is used here where we write Dynamic(name) so the name can be setup once more at start. Regular (static) columns writing to htoprc - i.e. numerically indexed - is unchanged.
Implements support for arbitrary Performance Co-Pilot
metrics with per-process instance domains to form new
htop columns. The column-to-metric mappings are setup
using configuration files which will be documented via
man pages as part of a follow-up commit.
We provide an initial set of column configurations so
as to provide new capabilities to pcp-htop: including
configs for containers, open fd counts, scheduler run
queue time, tcp/udp bytes/calls sent/recv, delay acct,
virtual machine guests, detailed virtual memory, swap.
Note there is a change to the configuration file path
resolution algorithm introduced for 'dynamic meters'.
First, look in any custom PCP_HTOP_DIR location. Then
iterate, in priority order, users home directory, then
local sysadmins files in /etc/pcp/htop, then readonly
configuration files below /usr/share/pcp/htop. This
final location becomes the preferred place for our own
shipped meter and column files.
The Settings file (htoprc) writing code is updated to
not using the numeric identifier for dynamic columns.
The same strategy used for dynamic meters is used here
where we write Dynamic(name) so the name can be setup
once more at start. Regular (static) columns writing
to htoprc - i.e. numerically indexed - is unchanged.