pm_set_program_pgroup_mx and pm_set_program_pgroup_mm Subroutines

Purpose

Sets Performance Monitor programmation in counter multiplexing mode and multi-mode for a target pthread and creates a counting group.

Library

Performance Monitor APIs Library (libpmapi.a)

Syntax

#include <pmapi.h>  

int pm_set_program_pgroup_mx ( pid,  tid,  ptid,  *prog)
pid_t pid;
tid_t tid;
ptid_t ptid;
pm_prog_mx_t *prog;

int pm_set_program_pgroup_mm ( pid, tid, ptid, *prog_mm)
pid_t pid;
tid_t tid;
ptid_t ptid;
pm_prog_mm_t *prog_mm;

Description

The pm_set_program_pgroup_mx and the pm_set_program_pgroup_mm subroutines set the Performance Monitor programmation respectively in counter multiplexing mode or in multi-mode for a target pthread. The pthread must be stopped and must be part of a debuggee process, under the control of the calling process.

The pm_set_program_pgroup_mx setting includes the list of the event arrays to be counted and a mode in which to count. The mode is global to all of the event lists. The events to count are in an array of list of event identifiers.

The pm_set_program_pgroup_mm setting includes the lists of the event arrays to be counted and the associated mode in which to count each event array. A counting mode is defined for each event array.

The event identifiers must be selected from the lists returned by the pm_inititialize subroutine.

Both subroutines create a counting group, which includes the target pthread and any pthread that it, or any of its descendants, will create in the future. Optionally, the group can be defined as also containing all the existing and future pthreads belonging to the target process.

If the pthread is running in 1:1 mode, only the tid parameter must be specified. If the pthread is running in m:n mode, only the ptid parameter must be specified. If both the ptid and tid parameters are specified, they must be referring to a single pthread with the ptid parameter specified and currently running on a kernel thread with specified tid parameter.

The counting mode for both subroutines includes the User Mode, or the Kernel Mode, or both of them; and the Initial Counting State. The defaults are set to Off for the User Mode and the Kernel Mode, and the initial default state is set to delay counting until the pm_start_pgroup subroutine is called.

When you use the pm_set_program_pgroup_mm subroutine for multi-mode counting, the Process Tree Mode and the Start Counting Mode are fixed by their values defined in the first programming set.

If the list includes an event that can be used with a threshold (as indicated by the pm_initialize subroutine), a threshold value can also be specified.

Parameters

Item Description
pid Process ID of target pthread. Target process must be a debuggee of the caller process.
tid Thread ID of target pthread. To ignore this parameter, set it to 0.
ptid Pthread ID of the target pthread. To ignore this parameter, set it to 0.
*prog Specifies the events and the modes to use in the Performance Monitor setup. The prog parameter supports the following modes:
PM_USER
Counts processes running in the User Mode (default is set to Off).
PM_KERNEL
Counts processes running in the Kernel Mode (default is set to Off).
PM_COUNT
Starts counting immediately (default is set to Not to Start Counting).
PM_PROCESS
Creates a process-level counting group.
*prog_mm Specifies the events and the modes to use in the Performance Monitor setup. The prog_mm parameter supports the following modes:
PM_USER
Counts processes running in the User Mode (default is set to Off).
PM_KERNEL
Counts processes running in the Kernel Mode (default is set to Off).
PM_COUNT
Starts counting immediately (default is set to Not to start counting).
PM_PROCTREE
Sets counting to On only for the calling process and its descendants (default is set to Off).

The PM_PROCTREE mode and the PM_COUNT mode defined in the first setting fix the value for the counting.

Return Values

Item Description
0 Operation completed successfully.
Positive Error Code Refer to the pm_error Subroutine to decode the error code.

Error Codes

Refer to the pm_error Subroutine.

Files

Item Description
/usr/include/pmapi.h Defines standard macros, data types, and subroutines.