It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

getrusage()

Synopsis:

Since:

BlackBerry 10.0.0

Arguments:

who

Which process to get the usage for:

RUSAGE_CHILDREN — get information about resources
used by the terminated and waited-for children of the current process.
If the child is never waited for
(e.g if the parent has SA_NOCLDWAIT set, or sets
SIGCHLD to SIG_IGN),
the resource information for the child process is discarded and isn't
included.

RUSAGE_SELF — get information about resources
used by the current process.

r_usage

A pointer to an object of type struct rusage in which
the function can store the resource information; see below.

Library:

libc

Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.

Description:

The getrusage() function provides measures of the resources
used by the current process or its terminated and waited-for
child processes, depending on the value of the who argument.

The total amount of time, in seconds and microseconds, spent executing in user mode.

ru_stime

The total amount of time, in seconds and microseconds, spent executing in system mode.

ru_maxrss

The maximum resident set size, given in pages.
See the Caveats section, below.

ru_ixrss

Not currently supported.

ru_idrss

An "integral" value indicating the amount of
memory in use by a process while the process is running.
This value is the sum of the resident set sizes of the process running when a clock tick occurs.
The value is given in pages times clock ticks.
It doesn't take sharing into account.
See the Caveats section, below.

ru_isrss

Not currently supported.

ru_minflt

The number of page faults serviced that didn't require any physical I/O activity.
See the Caveats section, below.

ru_majflt

The number of page faults serviced that required physical I/O activity.
This could include page ahead operations by the kernel.
See the Caveats section, below

ru_nswap

The number of times a process was swapped out of main memory.

ru_inblock

The number of times the file system had to perform input in servicing a read() request.

ru_oublock

The number of times the filesystem had to perform output in servicing a write() request.

ru_msgsnd

The number of messages sent over sockets.

ru_msgrcv

The number of messages received from sockets.

ru_nsignals

The number of signals delivered.

ru_nvcsw

The number of times a context switch resulted due to a process's voluntarily giving up the
processor before its timeslice was completed (usually to await availability of a resource).

ru_nivcsw

The number of times a context switch resulted due to a higher priority process's becoming
runnable or because the current process exceeded its time slice.

Classification:

Caveats:

Only the timeval fields of struct rusage are supported.

The numbers ru_inblock and ru_oublock account only for real I/O,
and are approximate measures at best.
Data supplied by the cache mechanism is charged only to the first process to read and the last process to write the data.

The way resident set size is calculated is an approximation,
and could misrepresent the true resident set size.

Page faults can be generated from a variety of sources and for a variety of reasons.
The customary cause for a page fault is a direct reference by the program to a page that isn't in memory.
Now, however, the kernel can generate page faults on behalf of the user, for example,
servicing read() and write() functions.
Also, a page fault can be caused by an absent hardware translation to a page,
even though the page is in physical memory.

In addition to hardware-detected page faults,
the kernel may cause pseudo page faults in order to perform some housekeeping.
For example, the kernel may generate page faults,
even if the pages exist in physical memory,
in order to lock down pages involved in a raw I/O request.

By definition, major page faults require physical I/O, while minor page faults don't.
For example, reclaiming the page from the free list would avoid I/O and generate a minor page fault.
More commonly, minor page faults occur during process startup as references to pages which are already in memory.
For example, if an address space faults on some "hot" executable or shared library,
a minor page fault results for the address space.
Also, anyone doing a read() or write() to something
that's in the page cache gets a minor page fault(s) as well.

There's no way to obtain information about a child process that hasn't yet terminated.

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.