<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Process introspection, resource consumption in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200759#M792473</link>
    <description>The RSS is the size of all private regions of memory in that if the process was to terminate this would be the size of memory freed, hence termed the resident set size of the process. This includes the data, stack, uarea, private mmap and possibly private text. Unfortunately you can only get the total mmap data from pstat, you need to look at the process memory regions in glance and sum up all the private areas. So your formula would be more like :&lt;BR /&gt;&lt;BR /&gt;RSS = data + stack + uarea + private-mmap&lt;BR /&gt;&lt;BR /&gt;So although only the virtual uarea size if listed it works out that approx 506749 pages are used for private mmap. &lt;BR /&gt;&lt;BR /&gt;I can't think offhand of a programmatic way to find if the mmap regions are private or not....you could use q4 but this would be a very long task unless you could code a perl script for it. I'll have a look and see what I can find out.&lt;BR /&gt;&lt;BR /&gt;- jm.</description>
    <pubDate>Wed, 25 Feb 2004 10:59:15 GMT</pubDate>
    <dc:creator>James Murtagh</dc:creator>
    <dc:date>2004-02-25T10:59:15Z</dc:date>
    <item>
      <title>Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200754#M792468</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;to obtain a clearer picture of real memory consumption of oracle (or any other) processes I delved into the struct definitions of the pstat() API, hoping to find enough explanation from the short line trailing comments therein&lt;BR /&gt;(manpages of ps, pstat are too vague and neglectant)&lt;BR /&gt; &lt;BR /&gt;However, due to my poor C coding and the absence of a troublefree ANSI C compiler I rely on CPAN's Proc::ProcessTable,&lt;BR /&gt;whose HP-UX implementation gives access to almost all struct members of __pst_status.&lt;BR /&gt;(I reckon the ps command is using this very struct although the leading underscores convey some sort of privacy) &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;$ perl -MProc::ProcessTable -e 'print "@{[Proc::ProcessTable-&amp;gt;new-&amp;gt;fields]}\n"'&lt;BR /&gt;uid  pid ppid dsize tsize ssize nice ttynum pgrp pri addr cpu utime stime start flag state wchan procnum cmndline fname time cpticks cptickstotal fss pctcpu rssize suid ucomm shmsize mmsize usize iosize vtsize vdsize vssize vshmsize vmmsize vusize viosize minorfaults majorfaults nswap nsignals msgrcv msgsnd maxrss sid schedpolicy ticksleft rdir cdir text highestfd euid egid ioch usercycles systemcycles interruptcycles gid lwpid&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Since I'm especially interested in memory consumption I go for the various sizes.&lt;BR /&gt;The so-called real d,s,t sizes are plausible to me.&lt;BR /&gt;But how can I interpret the so-called virtual entities?&lt;BR /&gt;Do they relate to the similar notion of virtual memory (viz. physical and swap memory combined)?&lt;BR /&gt; &lt;BR /&gt;These are the struct members I assume to be of interest to me.&lt;BR /&gt; &lt;BR /&gt;$ grep size /usr/include/sys/pstat/pm_pstat_body.h&lt;BR /&gt;        _T_LONG_T pst_dsize;    /* # real pages used for data */&lt;BR /&gt;        _T_LONG_T pst_tsize;    /* # real pages used for text */&lt;BR /&gt;        _T_LONG_T pst_ssize;    /* # real pages used for stack */&lt;BR /&gt;        _T_LONG_T pst_rssize;  /* resident set size for process (private pages) */&lt;BR /&gt;        _T_LONG_T pst_shmsize;  /* # real pages used for shared memory */&lt;BR /&gt;        _T_LONG_T pst_mmsize;   /* # real pages used for memory mapped files */&lt;BR /&gt;        _T_LONG_T pst_usize;    /* # real pages used for U-Area &amp;amp; K-Stack */&lt;BR /&gt;        _T_LONG_T pst_iosize;   /* # real pages used for I/O device mapping */&lt;BR /&gt;        _T_LONG_T pst_vtsize;   /* # virtual pages used for text */&lt;BR /&gt;        _T_LONG_T pst_vdsize;   /* # virtual pages used for data */&lt;BR /&gt;        _T_LONG_T pst_vssize;   /* # virtual pages used for stack */&lt;BR /&gt;        _T_LONG_T pst_vshmsize; /* # virtual pages used for shared memory */&lt;BR /&gt;        _T_LONG_T pst_vmmsize;  /* # virtual pages used for mem-mapped files */&lt;BR /&gt;        _T_LONG_T pst_vusize;   /* # virtual pages used for U-Area &amp;amp; K-Stack */&lt;BR /&gt;        _T_LONG_T pst_viosize;  /* # virtual pages used for I/O dev mapping */&lt;BR /&gt;        _T_LONG_T pst_maxrss;   /* highwater mark for proc resident set size */&lt;BR /&gt;        _T_LONG_T pst_text_size; /* Page size used for text objects. */&lt;BR /&gt;        _T_LONG_T pst_data_size; /* Page size used for data objects. */&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Feb 2004 10:19:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200754#M792468</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-02-24T10:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200755#M792469</link>
      <description>I also seek explanation of the flags member.&lt;BR /&gt; &lt;BR /&gt;To cite from ps's manpage&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;           flags          Flags (octal and additive) associated with the&lt;BR /&gt;                          process:&lt;BR /&gt; &lt;BR /&gt;                                0   Swapped&lt;BR /&gt;                                1   In core&lt;BR /&gt;                                2   System process&lt;BR /&gt;                                4   Locked in core (e.g., for physical I/O)&lt;BR /&gt;                               10   Being traced by another process&lt;BR /&gt;                               20   Another tracing flag&lt;BR /&gt;&lt;BR /&gt;                          The default heading for this column is F.&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Here an excerpt from oracle's processes&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;# UNIX95= ps -u oracle -o comm,sz,flags|head -5&lt;BR /&gt;COMMAND           SZ   F&lt;BR /&gt;oracleLOLA      14789 1001&lt;BR /&gt;oracleLOLA      14878 1001&lt;BR /&gt;oracleLOLA      14750 1001&lt;BR /&gt;oracleLOLA         0 1001&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Doing base 10 conversion the 01001 values from the F column equal 513.&lt;BR /&gt;But if I sum up the possibile values from the above manpage comment I at the most arrive at 37 (decimal) or 31 (octal).&lt;BR /&gt;What does 513 or 01001 mean?&lt;BR /&gt; &lt;BR /&gt;Little comment in the struct member definiton of __pst_stat&lt;BR /&gt; &lt;BR /&gt;       _T_LONG_T pst_flag;     /* flags associated with process */&lt;BR /&gt; &lt;BR /&gt;and a little farther down they even changed to base 16 when defining these macros&lt;BR /&gt;  &lt;BR /&gt;/*&lt;BR /&gt; * Process flag bits for pst_flag&lt;BR /&gt; */&lt;BR /&gt;#define PS_INCORE       0x1     /* this process is in memory */&lt;BR /&gt;#define PS_SYS          0x2     /* this process is a system process */&lt;BR /&gt;#define PS_LOCKED       0x4     /* this process is locked in memory */&lt;BR /&gt;#define PS_TRACE        0x8     /* this process is being traced */&lt;BR /&gt;#define PS_TRACE2       0x10    /* this traced process has been waited for */ &lt;BR /&gt;#define PS_TXTLOCKED    0x20    /* this process' text is locked in memory*/ &lt;BR /&gt;#define PS_DATLOCKED    0x40    /* this process' data is locked in memory*/ &lt;BR /&gt;#define PS_SYSCALLTRACE 0x80    /* per-process syscall tracing enabled */ &lt;BR /&gt;#define PS_SWLAZY       0x100   /* process has associated Lazy Swap region(s) */ &lt;BR /&gt;#define PS_64ASL        0x200   /* process has 64-bit address space layout */ &lt;BR /&gt;#define PS_CHANGEDPRIV  0x400   /* process was or is privileged */ &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;But anyway, maybe it's sufficient for me to check if the flag is 0 in order to find out if the process has been swapped out.</description>
      <pubDate>Tue, 24 Feb 2004 10:40:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200755#M792469</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-02-24T10:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200756#M792470</link>
      <description>Here a summation done in the Perl debugger with the scriplet attached.&lt;BR /&gt;I wonder how to interpret the numbers for the 811 procs during the __pst_stat call.&lt;BR /&gt; &lt;BR /&gt;  DB&amp;lt;1&amp;gt; c 28&lt;BR /&gt;main::(pstat.pl:28):    1;&lt;BR /&gt;  DB&amp;lt;2&amp;gt; x \%pst_stat_mem&lt;BR /&gt;0  HASH(0x8000000100309608)&lt;BR /&gt;   'dsize' =&amp;gt; 311839&lt;BR /&gt;   'mmsize' =&amp;gt; 1074415&lt;BR /&gt;   'rssize' =&amp;gt; 887354&lt;BR /&gt;   'shmsize' =&amp;gt; 1320968586&lt;BR /&gt;   'ssize' =&amp;gt; 81911&lt;BR /&gt;   'tsize' =&amp;gt; 11497780&lt;BR /&gt;   'vdsize' =&amp;gt; 427424&lt;BR /&gt;   'vmmsize' =&amp;gt; 3420918&lt;BR /&gt;   'vshmsize' =&amp;gt; 1337469570&lt;BR /&gt;   'vssize' =&amp;gt; 114352&lt;BR /&gt;   'vtsize' =&amp;gt; 13271497&lt;BR /&gt;   'vusize' =&amp;gt; 6488&lt;BR /&gt;  DB&amp;lt;3&amp;gt; p scalar @$user_procs&lt;BR /&gt;811&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Feb 2004 11:38:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200756#M792470</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-02-24T11:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200757#M792471</link>
      <description>Hi Ralph,&lt;BR /&gt;&lt;BR /&gt;When a process gets created and as it maps other areas into its address space it creates pregions or contiguous virtual address maps. There will be pregions for its text, data, stack segments etc. As the pregions must contain contiguous virtual addresses the full size of the memory oject must be mapped initially. The "real" pages are those in its pregion that are in-core or active in memory, the "virtual" pages is the total of the virtual address space allocated for that region. As the kernel brings pages in on demand and has to write back pages either to a backing store (swap) or front strore (the file itself in the case of mmap'd files) there may be some difference in the totals. The memory management white paper explains all this in glorious detail.&lt;BR /&gt;&lt;BR /&gt;For the ps flags output you need to do your base 10 conversion to base 16 :&lt;BR /&gt;&lt;BR /&gt;# echo 0o1001=X|adb              &lt;BR /&gt;  201&lt;BR /&gt;&lt;BR /&gt;So this will map quite nicely into the flag definitions from the pstat output. I'm really hoping your version of Oracle is 64 bit! :-)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;James.</description>
      <pubDate>Tue, 24 Feb 2004 12:50:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200757#M792471</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2004-02-24T12:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200758#M792472</link>
      <description>James,&lt;BR /&gt; &lt;BR /&gt;thanks for the explanation, but I still fail on basic page arithmetics.&lt;BR /&gt; &lt;BR /&gt;E.g. from Perl debugger session, where I summed up all sizes in a hashref $consumption over all processes run by oracle.&lt;BR /&gt; &lt;BR /&gt;  DB&amp;lt;9&amp;gt; !5&lt;BR /&gt;x $consumption&lt;BR /&gt;0  HASH(0x80000001004c06c0)&lt;BR /&gt;   'dsize' =&amp;gt; 340313&lt;BR /&gt;   'mmsize' =&amp;gt; 1148734&lt;BR /&gt;   'rssize' =&amp;gt; 940969&lt;BR /&gt;   'shmsize' =&amp;gt; 1434618003&lt;BR /&gt;   'ssize' =&amp;gt; 86951&lt;BR /&gt;   'tsize' =&amp;gt; 12486964&lt;BR /&gt;   'vdsize' =&amp;gt; 458656&lt;BR /&gt;   'vmmsize' =&amp;gt; 3660307&lt;BR /&gt;   'vshmsize' =&amp;gt; 1438192587&lt;BR /&gt;   'vssize' =&amp;gt; 121248&lt;BR /&gt;   'vtsize' =&amp;gt; 14270921&lt;BR /&gt;   'vusize' =&amp;gt; 6976&lt;BR /&gt;  DB&amp;lt;10&amp;gt; p 1434618003/(940969-340313-86951-12486964)&lt;BR /&gt;-119.818505805312&lt;BR /&gt; &lt;BR /&gt;For the supposed units (either mem pages or KB) I refer to cooments in pm_stat_body.h&lt;BR /&gt;There they only talk about pages.&lt;BR /&gt; &lt;BR /&gt;When I read the metric explanation for the so called Resident Set Size (RSS) from glance's help menu it ist explained as such:&lt;BR /&gt; &lt;BR /&gt;RSS = Stack + Data + Text + Shared/Refs&lt;BR /&gt; &lt;BR /&gt;As you can see from command line # 10 in debugger above, I tried to verify this calculation by isolating the Nos. of references to shared memory segments.&lt;BR /&gt; &lt;BR /&gt;So expanding for Refs would yield&lt;BR /&gt; &lt;BR /&gt;Refs = Shared / (RSS - Stack - Data - Text)&lt;BR /&gt; &lt;BR /&gt;As you can see above this yields negative refs which is crap.&lt;BR /&gt; &lt;BR /&gt;So what the hack is the damned __pst_status struct holding?&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2004 10:05:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200758#M792472</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-02-25T10:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Process introspection, resource consumption</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200759#M792473</link>
      <description>The RSS is the size of all private regions of memory in that if the process was to terminate this would be the size of memory freed, hence termed the resident set size of the process. This includes the data, stack, uarea, private mmap and possibly private text. Unfortunately you can only get the total mmap data from pstat, you need to look at the process memory regions in glance and sum up all the private areas. So your formula would be more like :&lt;BR /&gt;&lt;BR /&gt;RSS = data + stack + uarea + private-mmap&lt;BR /&gt;&lt;BR /&gt;So although only the virtual uarea size if listed it works out that approx 506749 pages are used for private mmap. &lt;BR /&gt;&lt;BR /&gt;I can't think offhand of a programmatic way to find if the mmap regions are private or not....you could use q4 but this would be a very long task unless you could code a perl script for it. I'll have a look and see what I can find out.&lt;BR /&gt;&lt;BR /&gt;- jm.</description>
      <pubDate>Wed, 25 Feb 2004 10:59:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-introspection-resource-consumption/m-p/3200759#M792473</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2004-02-25T10:59:15Z</dc:date>
    </item>
  </channel>
</rss>

