Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6468795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:55:23+00:00 2026-05-25T05:55:23+00:00

This code void print_usage(char * msg) { struct rusage usage; getrusage(RUSAGE_SELF, &usage); printf(Limits: %s\n,

  • 0

This code

 void print_usage(char * msg)
{
    struct rusage usage;
    getrusage(RUSAGE_SELF, &usage);
    printf("Limits: %s\n", msg);
    printf("  %s, %li\n",  " maximum resident set size "    , usage.ru_maxrss  );
    printf("  %s, %li\n",  " integral shared memory size "  , usage.ru_ixrss   );
    printf("  %s, %li\n",  " integral unshared data size "  , usage.ru_idrss   );
    printf("  %s, %li\n",  " integral unshared stack size " , usage.ru_isrss   );
    printf("  %s, %li\n",  " page reclaims "                , usage.ru_minflt  );
    printf("  %s, %li\n",  " page faults "                  , usage.ru_majflt  );
    printf("  %s, %li\n",  " swaps "                        , usage.ru_nswap   );
    printf("  %s, %li\n",  " block input operations "       , usage.ru_inblock );
    printf("  %s, %li\n",  " block output operations "      , usage.ru_oublock );
    printf("  %s, %li\n",  " messages sent "                , usage.ru_msgsnd  );
    printf("  %s, %li\n",  " messages received "            , usage.ru_msgrcv  );
    printf("  %s, %li\n",  " signals received "             , usage.ru_nsignals);
    printf("  %s, %li\n",  " voluntary context switches "   , usage.ru_nvcsw   );
    printf("  %s, %li\n",  " involuntary context switches " , usage.ru_nivcsw  );

}

reports only zeroes for many fields, even if I use it in rather big program (after jvm start)

   maximum resident set size , 0
   integral shared memory size , 0
   integral unshared data size , 0
   integral unshared stack size , 0
   page reclaims , 2514
   page faults , 0
   swaps , 0
   block input operations , 0
   block output operations , 0
   messages sent , 0
   messages received , 0
   signals received , 0
   voluntary context switches , 137
   involuntary context switches , 1

The non-zero fields are “*vcsw“, “*flt“.

All *rss, *swap, msg*, *block, *signals are Zero.

Is there something broken?

Linux is x86 2.6.30.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:55:23+00:00Added an answer on May 25, 2026 at 5:55 am

    Yes it is partly broken. Not all fields are filled by kernel. http://www.kernel.org/doc/man-pages/online/pages/man2/getrusage.2.html

    Working fields:

       ru_utime
       ru_stime
       ru_maxrss (since Linux 2.6.32)
       ru_minflt
       ru_majflt
       ru_inblock (since Linux 2.6.22)
       ru_oublock (since Linux 2.6.22)
       ru_nvcsw (since Linux 2.6)
       ru_nivcsw (since Linux 2.6)
    

    Unused fields:

       ru_ixrss (unmaintained)
       ru_idrss (unmaintained)
       ru_isrss (unmaintained)
       ru_nswap (unmaintained)
       ru_msgsnd (unmaintained)
       ru_msgrcv (unmaintained)
       ru_nsignals (unmaintained)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: void res(int a,int n) { printf(%d %d, ,a,n); } void main(void)
So this code has the off-by-one error: void foo (const char * str) {
see this code #include<stdio.h> int main() { void test(void) { printf(test); return; } printf(main);
I have this code private void writeReport(IReport report, string reportName) { string reportString =
Eg. can I write something like this code: public void InactiveCustomers(IEnumerable<Guid> customerIDs) { //...
consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker
Given this piece of code: (void)someFunction(void) { int array[] = {1,2,3,4,5,6,7,8,9,10}; } Where are
i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
This code leads to undefined behavior: void some_func() { goto undefined; { T x
This code compiles: private static void Main(string[] args) { bool? fred = true; if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.