Skip to content

Conversation

@orasagar
Copy link
Contributor

No description provided.

Revise pcp-top.1 to replace slabinfo references with accurate top-like monitor details, update description to reflect real-time process/system metrics, and document new command-line options for improved usability and clarity.
…p.py memory formatting

- Added pcp-top archive files and mk.top script for reproducibility and QA.
- Refactored pcp-top.py to use GIGABYTE constant for memory formatting.
- Improved load average handling in pcp-top.py for robustness with fallback values.
Refactored TopUtil to cache process metrics for improved efficiency and reduced repeated lookups. Introduced unified metric fetching helper and updated memory usage calculation method to leverage cached values. Removed unused import and cleaned up method definitions for clarity.
- Clarify 'START' field as user+system time (MM:SS) in man page
- Correct default process count from 2000 to 100 in CLI docs
- Enhance process_data_list with documentation on returned structure and sorting logic
Introduce test script 1904 to automate verification of pcp-top output under various sorting and filter options.
Replace lambda functions with direct method calls for vsize and rss conversion to gigabytes in process listing.
Refactored per-process field descriptions in the pcp-top manpage.
This reverts commit 37a7567.
@kurik
Copy link
Contributor

kurik commented Nov 12, 2025

@orasagar We already have pcp-atop and pcp-htop. What is the reason to add pcp-top ? Is there any use case which either pcp-atop or pcp-htop does not cover ?

@natoscott
Copy link
Member

Yeah, agreeing with @kurik here - not sure there's a need for a third top-like tool in PCP. It'd be best to improve the existing ones if features are missing - pcp-htop in particular is under active development and even supports arbitrary metrics (i.e. beyond top processes). Is there something novel in this new approach I'm missing here @orasagar ? Thanks!

@orasagar
Copy link
Contributor Author

Hi @kurik and @natoscott ,
I agree with you that pcp-atop and pcp-htop are useful tools to work with. They perform well on live systems; however, when replaying archived data, processing time becomes a concern. In our testing, it has taken more than 30 minutes just to open half a day’s archive, and stakeholders have reported frustration with the slow performance.

Additionally, both tools output data in a slightly different format compared to other PCP tools currently in use. This inconsistency makes parsing more difficult. with this tool we are trying to achieve is give user flexibility to sort top %cpu or %mem consumer.

@natoscott
Copy link
Member

@orasagar this new pcp-top uses the same PMAPI interfaces so has exactly the same performance issues, no? Do you have some perf profiles you can share showing the problem and how pcp-top resolves it? FWIW, pcp-htop does not yet support archive mode (this would be wonderful to add though).

pcp-atop can be slow on some archives, but there have been numerous improvements recently, particularly when using zstd compression - have you tried this? IMO the answer to improved performance is not to add a new tool, but to analyse and improve the existing tools.

Re sorting output, it makes little sense to me to post-process top tool output - why not use something like pmrep or the top-most options to pcp-atopsar? However, if you must do sorting, then implement a new output mode for an existing tool, no need to add an entire new one. The upstream atop code has a JSON output option, perhaps we should back-port that to pcp-atop?

Finally, there was a pcp-xsos tool added last year to provide another, single-sample rapid overview from an archive - might help those users with performance concerns as well.

@orasagar
Copy link
Contributor Author

@natoscott I don’t have performance profiles to share at the moment, but I’d like to clarify the motivation behind this tool.

The main goal is to bring consistency with other PCP tools output and align more closely with the standard top batch mode output. While similar functionality can be achieved with pmrep, it requires user to know specific metrics, which isn’t always straightforward. Looking ahead, I plan to evolve this tool to use hotproc metrics, making it more dynamic and flexible as those metrics are captured.

I agree that backporting the JSON output option is a good idea, but it will take some time. Also, atop already has a very large set of options, which can be overwhelming for users. The intent here is to provide a simpler, more consistent interface that addresses common use cases without adding to that complexity.

@natoscott
Copy link
Member

Hi @orasagar,

While similar functionality can be achieved with pmrep, it requires user to know specific metrics, which isn’t always straightforward.

Have a look below /etc/pcp/pmrep - these files configure sets of metrics that can be requested on the pmrep command line, as a group, to address this kind of problem.

Looking ahead, I plan to evolve this tool to use hotproc metrics, making it more dynamic and flexible as those metrics are captured.

pcp-atop(1) already has a mode where it can use hotproc metrics FWIW - see the --hotproc option.

@orasagar
Copy link
Contributor Author

orasagar commented Nov 20, 2025

Hi @natoscott ,
If you agree, I can implement sorting of processes (--sort option) based on %MEM and %CPU in pcp ps, similar to what ps already supports.

@natoscott
Copy link
Member

@orasagar sounds like a good idea to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants