[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

Getting System Information

You can select a topic from this diagram:

Utilities Used by the IDE Getting System Information Using Code Coverage Common Wizards Reference Preparing Your Target Developing Photon Applications Developing C/C++ Programs Where Files Are Stored Building OS and Flash Images Migrating to the 6.3 Release Tutorials IDE Concepts About This Guide Analyzing Your System With Kernel Tracing Profiling an Application Finding Memory Errors Debugging Programs Managing Source Code Launch Configurations Reference

Workflow diagram with system information chapter highlighted


This chapter shows you how to work with the System Information perspective.


Introduction

The IDE provides a rich environment not only for developing and maintaining your software, but also for examining the details of your running target systems.

Within the IDE, you'll find several views whose goal is to provide answers to such questions as:

Such questions play an important role in your overall system design. The answers to these questions often lie beyond examining a single process or thread, as well as beyond the scope of a single tool, which is why a structured suite of integrated tools can prove so valuable.

The tools discussed in this chapter are designed to be mixed and matched with the rest of the IDE's development components to help you gain insight into your system and thereby develop better products.

What the System Information perspective reveals

The System Information perspective provides a complete and detailed report on your system's resource allocation and use, along with key metrics such as CPU usage, program layout, the interaction of different programs, and more:

System Information perspective

The perspective's metrics may prove useful throughout your development cycle, from writing and debugging your code through your quality-control strategy.

Key terms

Before we describe how to work with the System Information perspective, let's first briefly discuss the terms used in the perspective itself. The main items are:

thread
The minimum "unit of execution" that can be scheduled to run.
process
A "container" for threads, defining the virtual address space within which threads will execute. A process will always contain at least one thread. Each process has its own set of virtual addresses, typically ranging from 0 to 4G.

Threads within a process share the same virtual memory space, but have their own stack. This common address space lets threads within the process easily access shared code and data, and lets you optimize or group common functionality, while still providing process-level protection from the rest of the system.

scheduling priority
Neutrino uses priorities to establish the order in which threads get to execute when multiple threads are competing for CPU time.

Each thread can have a scheduling priority ranging from 1 to 255 (the highest priority), independent of the scheduling policy. The special idle thread (in the process manager) has priority 0 and is always ready to run. A thread inherits the priority of its parent thread by default.

You can set a thread's priority using the pthread_setschedparam() function.

scheduling policy
When two or more threads share the same priority (i.e. the threads are directly competing with each other for the CPU), the OS relies on the threads' scheduling policy to determine which thread should run next. Three policies are available:

You can set a thread's scheduling policy using the pthread_setschedparam() function or you can start a process with a specific priority and policy by using the on -p command (see the Utilities Reference for details).

state
Only one thread can actually run at any one time. If a thread isn't in this RUNNING state, it must either be READY or BLOCKED (or in one of the many "blocked" variants).
message passing
The most fundamental form of communication in Neutrino. The OS relays messages from thread to thread via a send-receive-reply protocol. For example, if a thread calls MsgSend(), but the server hasn't yet received the message, the thread would be SEND-blocked; a thread waiting for an answer is REPLY-blocked, and so on.
channel
Message passing is directed towards channels and connections, rather than targeted directly from thread to thread. A thread that wishes to receive messages first creates a channel; another thread that wishes to send a message to that thread must first make a connection by "attaching" to that channel.
signal
Asynchronous event notifications that can be sent to your process. Signals may include:

The OS supports the standard POSIX signals (as in UNIX) as well as the POSIX realtime signals. The POSIX signals interface specifies how signals target a particular process, not a specific thread. To ensure that signals go to a thread that can handle specific signals, many applications mask most signals from all but one thread.

You can specify the action associated with a signal by using the sigaction() function, and block signals by using sigprocmask(). You can send signals by using the raise() function, or send them manually using the Target Navigator view (see "Sending a signal" below).


Note: For more information on all these terms and concepts, see the QNX Neutrino Microkernel chapter in the System Architecture guide.

The views in this perspective

You use the views in the System Information perspective for these main tasks:

To: Use this view:
Control your system information session. Target Navigator view
Examine your target system's attributes. System Summary
Watch your processes and view thread activity. Process Information
Inspect virtual address space. Memory Information
Track heap usage. Malloc Information
Examine process signals. Signal Information
Get channel information. System Blocking Graph
Track file descriptors. Connection Information
Track resource usage. System Resources

Controlling your system information session

The selections you make in the Target Navigator view control the information you see in the System Information perspective:

Target Navigator view

You can customize the Target Navigator view to:

To access the Target Navigator view's customization menu, click the menu button (Icon: Menu dropdown) in the Target Navigator view's title bar.

You can reverse a selected sort order by clicking the Reverse sort button (Icon: Reverse sort) in the view's title bar.

You can enable or disable the automatic refresh by clicking the Automatic Refresh button (Icon: Automatic Refresh) in the view's title bar. Entries in the Target Navigator are grey when their data is stale and needs refreshing.

If you've disabled automatic refresh, you can refresh the Target Navigator by right-clicking and choosing Refresh from the context menu.

The Target Navigator view also lets you control the information displayed by the following views:

To control the display in the Malloc Information or Memory Information view:

=>> In the Target Navigator view, expand a target and select a process:

Target Navigator view; Memory Trace

Sending a signal

The Target Navigator view lets you send signals to the processes on your target. For example, you can terminate a process by sending it a SIGTERM signal.

To send a signal to a process:

  1. In the Target Navigator view, right-click a process and select Deliver Signal.

    Target Navigator view; Deliver Signal dialog

  2. Select a signal from the dropdown menu.
  3. Click OK. The IDE delivers the signal to your selected process.

Caution: Delivering a signal to a process will, in most cases, cause that process to terminate.

Updating the views

To update the views in the System Information perspective:

=>> In the Target Navigator view, expand a target and select a process. (You can also select groups of processes by using the Ctrl or Shift keys.) The views reflect your selection.

The data displayed in the System Information perspective is updated automatically whenever new data is available.

Adding views to the System Information perspective

By default, some views don't appear in the System Information perspective. To add a view to the perspective:

  1. From the main menu, select Window-->Show View and select a view.
  2. The view appears in your perspective.
  3. If you want to save a customized set of views as a new perspective, select Window-->Save Perspective As from the main menu.

Note: Some of the views associated with the System Information perspective can add a noticeable processing load to your host CPU. You can improve its performance by:
  • Closing the System Information perspective when you're not using it.
  • Closing unneeded views within the perspective. You can instantly reopen all the closed views by selecting Window-->Reset Perspective from the main menu.
  • Reducing the refresh rate (as described above).
  • Minimizing or hiding unneeded views.

Examining your target system's attributes

The System Summary view displays a listing of your target's system attributes, including your target's processor(s), memory, active servers, and processes:

System Summary view

The System Summary view includes the following panes:

System Specifications pane

The System Specifications pane displays your system's hostname, board type, OS version, boot date, and CPU information. If your target is an SMP system, the pane lists CPU information for each processor.

System Memory pane

The System Memory pane displays your system's total memory and free memory in numerical and graphical form.

Processes panes

The Processes panes display the process name, heap usage, CPU usage time, and start time for the processes running on your selected target. The panes lets you see application processes, server processes, or both. Server processes have a session ID of 1; application processes have a session ID greater than 1.

Watching your processes

The Process Information view displays information about the processes you select in the Target Navigator view. The view shows the name of the process, its arguments, environment variables, and so on. The view also shows the threads in the process and the states of each thread:

Process Information view

The Process Information view includes the following panes:

Thread Details pane

The Thread Details pane shows information about your selected process's threads, including the thread's ID, priority, scheduling policy, state, and stack usage.

The Thread Details pane lets you display a substantial amount of information about your threads, but some of the column entries aren't shown by default.

To configure the information displayed in the Thread Details pane:

  1. In the Process Information view, click the menu dropdown button (Icon: Menu).
  2. Select Configure. The Configure dialog appears:

    Process Information view; Configure dialog

  3. You can:
  4. Click OK. The view displays the entries that you specified in the New Items list.

Environment Variables pane

The Environment Variables pane provides the values of the environment variables that are set for your selected process. (For more information, see the Commonly Used Environment Variables appendix in the Utilities Reference.

Process Properties pane

The Process Properties pane shows the process's startup arguments, and the values of the process's IDs: real user, effective user, real group, and effective group.

The process arguments are the arguments that were used to start your selected process as they were passed to your process, but not necessarily as you typed them. For example, if you type ws *.c, the pane might show ws cursor.c io.c my.c phditto.c swaprelay.c, since the shell expands the *.c before launching the program.

The process ID values determine which permissions are used for your program. For example, if you start a process as root, but use the seteuid() and setegid() functions to run the program as the user jsmith, the program runs with jsmith's permissions. By default, all programs launched from the IDE run as root.

Examining your target's memory

Two views in the QNX System Information perspective are especially useful for examining the memory of your target system:

Malloc Information view

The Malloc Information view displays statistical information from the general-purpose, process-level memory allocator:

Malloc Information view

When you select a process in the Target Navigator view, the IDE queries the target system and retrieves the allocator's statistics. The IDE gathers statistics for the number of bytes that are allocated, in use, and overhead.

The view includes the following panes:

Total Heap

The Total Heap pane shows your total heap memory, which is the sum of the following states of memory:

The bar chart shows the relative size of each.

Calls Made

The Calls Made pane shows the number of times a process has allocated, freed, or reallocated memory by calling malloc(), free(), and realloc() functions. (See the Library Reference.)

Core Requests

The Core Requests pane displays the number of allocations that the system allocator automatically made to accommodate the needs of the program you selected in the Target Navigator view. The system allocator typically dispenses memory in increments of 4K (one page).

The number of allocations will never equal the number of deallocations, because when the program starts, it allocates memory that isn't released until it terminates.

Distribution

The Distribution pane shows a distribution of the memory allocation sizes. The pane includes the following columns:

Byte Range
The size range of the memory blocks.
Total mallocs and frees
The total number of calls that effectively allocate or free memory. For example, if your program reallocated memory from 10 bytes to 20 bytes, both the free count for the 0-16 byte range and the malloc count for the 17-32 range would increment.
Allocated
The remaining number of allocated blocks. The value is equal to the number of allocations minus the number of deallocations.
% Returned
The ratio of freed blocks to allocated blocks, expressed as a percentage. The value is calculated as the number of deallocations divided by the number of allocations.
Usage (min/max)
The calculated minimum and maximum memory usage for a byte range. The values are calculated by multiplying the number of allocated blocks by the minimum and maximum sizes of the range. For example, if the 65-128 byte range had two blocks allocated, the usage would be 130/160. You should use these values for estimated memory usage only; the actual memory usage will usually lie somewhere in between.

History

The History pane shows a chronology of the heap usage shown in the Total Heap pane. The pane automatically rescales as the selected process increases its total heap.

The History pane updates the data every second, with a granularity of 1K. Thus, two 512-byte allocations made over several seconds trigger one update.


Note: You can choose to hide or display the Distribution and History panes:
  1. In the Malloc Information view's title bar, click the dropdown menu button (Icon: Dropdown Menu), followed by Show.
  2. Click the pane you want displayed.

Virtual address space

The Memory Information view displays the memory used by the process you select in the Target Navigator view:

Memory Information view

The view shows the following major categories of memory usage:

The Process Memory pane shows the overall memory usage. To keep large sections of memory from visually overwhelming smaller sections, the view scales the display semilogarithmically and indicates compressed sections with a split.

Below the Process Memory pane, the Process Memory subpane shows your selected memory category (e.g. Stack, Library) linearly. The subpane colors the memory by subcategory (e.g. a stack's guard page), and shows unused memory.

The Memory Information view's table lists all the memory segments and the associated virtual address, size, permissions, and offset. The major categories list the total sizes for the subcategories (e.g. Library lists the sizes for code/data in the Size column). The Process Memory pane and subpane update their displays as you make selections in the table.

The Memory Information view's table includes the following columns:

Name
The name of the category.
V. Addr.
The virtual address of the memory.
Size
The size of the section of memory. For the major categories, the column lists the totals for the minor categories.
Map Flags
The flags and protection bits for the memory block. See the mmap() function's flags and prot arguments in the Library Reference.
Offset
The memory block's offset into shared memory, which is equal to the mmap() function's off argument.

To toggle the Memory Information view's table arrangement between a flat list and a categorized list:

=>> Select the dropdown menu (Icon: Menu) in the Memory Information view's title bar and select Categorize.

Stack errors

Stack errors can occur if your program contains functions that are deeply recursive or use a significant amount of local data. Errors of this sort can be difficult to find using conventional testing; although your program seems to work properly during testing, the system could fail in the field, likely when your system is busiest and is needed the most.

The Memory Information view lets you see how much stack memory your program and its threads use. The view can warn you of potential stack errors.

Inefficient heap usage

Your program can experience problems if it uses the heap inefficiently. Memory-allocation operations are expensive, so your program may run slowly if it repeatedly allocates and frees memory, or continuously reallocates memory in small chunks.

The Malloc Information view displays a count of your program's memory allocations; if your program has an unusually high turnover rate, this might mean that the program is allocating and freeing more memory than it should.

You may also find that your program uses a surprising amount of memory, even though you were careful not to allocate more memory than you required. Programs that make many small allocations can incur substantial overhead.

The Malloc Information view lets you see the amount of overhead memory the malloc library uses to manage your program's heap. If the overhead is substantial, you can review the data structures and algorithms used by your program, and then make adjustments so that your program uses its memory resources more efficiently. The Malloc Information view lets you track your program's reduction in overall memory usage.


Note: To learn more about the common causes of memory problems, see Heap Analysis: Making Memory Errors a Thing of the Past in the QNX Neutrino Programmer's Guide.

Examining process signals

The Signal Information view shows the signals for the processes selected in the Target Navigator view.

Signal Information view

The view shows signals that are:

You can send a signal to any process by using the Target Navigator view (see the section "Sending a signal" in this chapter.)

Getting channel information

The System Blocking Graph view presents a color-coded display of all the active channels in the system and illustrates the interaction of threads with those channels.

Interaction with resource objects are such that a thread can be blocked waiting for access to the resource or waiting for servicing (i.e. the thread is SEND-blocked on a channel).

The thread could also be blocked waiting for a resource to be released back to the thread or waiting for servicing to terminate (i.e. the thread is REPLY-blocked).

Clients in such conditions are shown on the left side of the graph, and the resource under examination is in the middle. Threads that are waiting to service a request or are active owners of a resource, or are actively servicing a request, are displayed on the right side of the graph:

System Blocking Graph

In terms of "classical" QNX terminology, you can think of the items in the legend at the top of the graph like this:

Legend item Thread state
Servicing request Not RECEIVE-blocked (e.g. RUNNING, blocked on a mutex, etc.)
Waiting for request RECEIVE-blocked
Waiting for reply REPLY-blocked
Waiting for service SEND-blocked

Tracking file descriptors

The Connection Information view displays the file descriptors, server, and connection flags related to your selected process's connections. The view also shows (where applicable) the pathname of the resource that the process accesses through the connection:

Connection Information view

The information in this view comes from the individual resource manager servers that are providing the connection. Certain resource managers may not have the ability to return all the requested information, so some fields will be left blank.

The IOFlags column describes the read (r) and write (w) status of the file. A double dash (--) indicates no read or write permission; a blank indicates that the information isn't available.

The Seek Offset column indicates the connector's offset from the start of the file.

Note that for some FDs, an "s" appears beside the number. This means that the FD in question was created via a side channel -- the connection ID is returned from a different space than file descriptors, so the ID is actually greater than any valid file descriptor.

For more information on side channels, see ConnectAttach() in the Library Reference.

To see the full side channel number:

  1. In the Connection Information view, click the menu dropdown button (Icon: Menu).
  2. Select Full Side Channels.

Tracking resource usage

The System Resources view shows various pieces of information about your system's processes. You can choose one of the following displays:

To select which display you want to see, click the menu dropdown button (Icon: Menu) in the System Resources view.

System Uptime display

The System Uptime display provides information about the start time, CPU usage time, and the usage as a percent of the total uptime, for all the processes running on your selected target:

System Resources view; System uptime

General Resources display

The General Resources display provides information about CPU usage, heap size, and the number of open file descriptors, for all the processes running on your selected target.

System Resources view; General resources

Memory Resources display

The Memory Resources display provides information about the heap, program, library, and stack usage for each process running on your selected target:

System Resources view; Memory resources

To learn more about the meaning of the values shown in the Memory Resources display, see the Finding Memory Errors chapter in this guide.


[Previous] [Contents] [Index] [Next]