I'm new in Perl and what I would like to do ,for a given pid,is to parse from all virtual addresses to physical ones and the related information about PTE soft-dirty bit at each time interval . So what I would like to get ,by supposing an overall duration of 1 second and an observation time of 0.1 s(Thus I should get an array/list of 10 elements zero or one) is a data structure like this:

#PageNumberKey Soft_dirty-bit [pageframenumber#1]-> [0 1 0 0 1 1 0 0 1 1] [pageframenumber#2]-> [0 0 0 1 1 0 0 0 0 0] [pageframenumber#3]-> [0 0 0 0 0 1 0 0 1 0] [pageframenumber#4]-> [1 1 0 0 1 1 1 0 0 1] [pageframenumber#5]-> [1 1 0 0 0 0 0 0 1 1] ........................ ..........................
I'm thinking something like each hash key is linked to a list of values(array), but before that I need to parse the binary file proc/pid/pagemap in linux and then getting the above structure. I read something around ,but I got stuck at the moment. The structure of that file can be found at https://www.kernel.org/doc/Documentation/vm/pagemap.txt . I read something around ,but I got stuck at the moment. Thanks for reading.Any help/solution is very appreciated . PS: I also asked for help at stackoverflow so that I might have more chance to get an answer!

In reply to How to parse /proc/pid/pagemap and create an appropriate data structure by PerlNew99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.