Skip to content

Conversation

@estodi
Copy link
Contributor

@estodi estodi commented May 11, 2025

Added support for the more-extended and most-extended options.

//
// 1234: /some/path
// Address Perm Offset Device Inode Size Rss Pss Pss_Dirty Referenced Anonymous LazyFree ShmemPmdMapped FilePmdMapped Shared_Hugetlb Private_Hugetlb Swap SwapPss Locked THPeligible Mapping
// 000073eb5f4c7000 r-xp 0000000000036000 008:00008 2274176 1284 1148 1148 0 1148 0 0 0 0 0 0 0 0 0 0 ld-linux-x86-64.so.2
Copy link
Contributor

@cakebaker cakebaker May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some differences with leading zeros compared to the output of the original pmap:

  • for the Address, the original pmap doesn't show leading zeros, it uses spaces instead
  • the length of the Offset is eight characters with the original pmap
  • for the Device, the original pmap uses the xx:xx format

I don't know whether you want to fix it in this PR. As the values themselves are correct (and the PR is already on the bigger side), it's also ok to add a todo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm aware of these differences and plan to address them later, separate from this PR. (Since it seems you originally authored these lines, please let me know if you recall any specific intentions for implementing them as they are now.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented them to work for the default, extended (-x), and device (-d) formats. The more-extended and most-extended formats unfortunately differ in how some of the same data is shown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, understood. Because managing those different formats would also be related to the range option, please allow me to address it independently of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's fine :)

//
// 1234: /some/path
// Address Perm Offset Device Inode Size KernelPageSize MMUPageSize Rss Pss Pss_Dirty Shared_Clean Shared_Dirty Private_Clean Private_Dirty Referenced Anonymous LazyFree AnonHugePages ShmemPmdMapped FilePmdMapped Shared_Hugetlb Private_Hugetlb Swap SwapPss Locked THPeligible VmFlags Mapping
// 000073eb5f4c7000 r-xp 0000000000036000 008:00008 2274176 1284 4 4 1148 1148 0 0 0 1148 0 1148 0 0 0 0 0 0 0 0 0 0 0 rd ex mr mw me ld-linux-x86-64.so.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment about leading zeros.

pub vmflags: bool,
pub mapping: bool,
// Misc
pub custom_format_enabled: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what's the reason for this property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is used to determine which output format to choose in pmap main. The more-extended and most-extended options seem to share the same format as the read-rc options (used for output field customization), while the extended, device, and default options have their own formats. This property will also be used when implementing the read-rc options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether this property should be part of PmapConfig. At least conceptually it is different from all the other properties: they are about enabling a specific field whereas custom_format_enabled, if true, is more like a format like more-extended. And you could say a "custom format" has a PmapConfig. On the other hand it's also possible I misunderstand something :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would include this property in PmapConfig because it essentially corresponds to a pmaprc configuration file. When you look at a pmaprc file generated by pmap -N, you'll see two categories of configurations: [Fields Display], which we're currently dealing with, and [Mapping], which is yet to be implemented. From this, we understand that pmaprc controls which fields to print and how to print them. I realize it might seem a bit odd to have custom_format_enabled in PmapConfig right now, but once we add the show_path property in later PRs, it will make sense to have custom_format_enabled here, wouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's try it :) We can always refactor it later if necessary.

@cakebaker
Copy link
Contributor

I plan to continue with the review of the other files tomorrow.

estodi and others added 3 commits May 12, 2025 08:54
@cakebaker cakebaker merged commit 1dafe8d into uutils:main May 14, 2025
13 checks passed
@cakebaker
Copy link
Contributor

Thanks!

@codecov
Copy link

codecov bot commented May 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (81d0d37) to head (60925f6).
Report is 11 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #415   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants