Hello everyone,
I have made the final round of changes to the interface to address
some issues reported during the review on LKML.
Unfortunately, those changes are NOT backward compatible with existing 2.2
interface.
As a consequence, I have now changed the version of the perfmon development
source to
2.3 (from 2.2). Backward compatibility with existing mainline (and distro)
perfmon
for Itanium is MAINTAINED AND UNCHANGED.
The changes are as follows:
1/ pfm_create_evtsets()/pfm_delete_evtsets()
The pfarg_setdesc_t structure has changed:
typedef struct {
uint16_t set_id; /* which set */
uint16_t set_id_next; /* next set to go to (must use
PFM_SETFL_EXPL_NEXT) */
uint32_t set_flags; /* input: flags for set, output: err
flag */
uint64_t set_timeout; /* requested/effective switch timeout
in nsecs */
^^^^^^^^
uint64_t set_mmap_offset; /* cookie to pass as mmap offset to
access 64-bit virtual PMD */
uint64_t reserved[5]; /* for future use */
} pfarg_setdesc_t;
The set_timeout is now 64-bit wide and is expressed in nanosecond. This is
more
or less how time (or timeout) is expressed with other system calls (e.g.,
nanosleep, gettimeofday).
2/ pfm_getinfo_evtsets()
The pfarg_setinfo_t structure has changed to match the changes in
pfarg_setdesc_t:
typedef struct {
uint16_t set_id; /* which set */
uint16_t set_id_next; /* output: next set to go to (must
use PFM_SETFL_EXPL_NEXT) */
uint32_t set_flags; /* output:flags or error */
uint64_t set_ovfl_pmds[PFM_PMD_BV]; /* output: last ovfl PMDs
which triggered a switch from set */
uint64_t set_runs; /* output: number of times the set
was active */
uint64_t set_timeout; /* output:effective/leftover switch
timeout in nsecs */
^^^^^^^^
uint64_t set_act_duration; /* DO NOT USE: number of cycles set
was active (syswide only) */
uint64_t set_mmap_offset; /* cookie to pass as mmap offset to
access 64-bit virtual PMD */
uint64_t set_avail_pmcs[PFM_PMC_BV];
uint64_t set_avail_pmds[PFM_PMD_BV];
uint64_t reserved[4]; /* for future use */
}
3/ UUID removal
Sampling formats are no longer identified by 128-bit UUID. People thought it
was overkill and
difficult to manipulate. They suggested using simple strings which are much
easier to manipulate.
I made the change now.
Here are the mappings:
perfmon v2.0 default format -> "default-old"
perfmon v2.2 v2.3 default format -> "default"
When operating in v2.0 compatibility mode (i.e., using perfmonctl()), there
is no need to remove the
UUID parameter. The kernel will convert it to "default-old". Only the old
default format will be accepted
when coming via perfmonctl().
The information reported in /sys/kernel/perfmon/formats has changed
accordingly. The clear text UUID is gone.
Each format gets a directory (as before), and inside each directory you find
2 entries:
- smpl_version: print a version number of rot eh format, expressed as
X.Y
- smpl_argsize: the size of the argument to the format for
pfm_create_context()
4/ pfm_create_context()
Given the changes with UUID, I have decided it was time to refresh the call
completely to align it
with other common Linux(or UNIX) practices. In particular, the following
changes were made:
- the file descriptor is now returned by the call rather than in the
parameters. This follows the model
of open(), socket().
- the sampling format name is added as a parameter
- the actual sampling buffer size is not returned anymore. For formats,
that need a size, it is typically passed in
the sampling format argument. You simply use the same size value for
mmap, munmap.
Both mmap() and munmap() align to the next page boundary
automatically.
- the pfarg_ctx_t structure has been vastly simplified to only contain
ctx_flags. it is not modified by the call as it
used to be in v2.2.
Here is the new definition:
int pfm_create_context(pfarg_ctx_t *ctx, char *fmt_name, char *fmt_arg,
size_t fmt_argsize);
Where pfarg_ctx_t is defined as:
typedef struct {
uint32_t ctx_flags; /* noblock/block/syswide */
uint32_t ctx_reserved1; /* for future use */
uint64_t ctx_reserved3[7]; /* for future use */
} pfarg_ctx_t;
fmt_name : the name of the format you want to use. Pass NULL if no
format is used
fmt_arg : pointer to argument for format. Not all formats take
arguments, but the default does (no changes to it)
fmt_arg_size: the size of the structure passed in fmt_arg
Return:
>=0 : the file desriptor for the context
-1: error, errno contains the error code
Internally as a consequence of the changes, the code has been simplified
some more, especially for
pfm_create_context(). So I think this is a change for the better.
The changes will be part of the next kernel patch. Similarly, the next
releases of pfmon/libpfm will
adjust to the kernel changes.
Any comments?
--
-Stephane
--
-Stephane
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/