|
Packit Service |
c5cf8c |
#!/usr/bin/env perl
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
# (C) 2011 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
# See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# A simple perl script that takes handle values as arguments and decodes them.
|
|
Packit Service |
c5cf8c |
# It can help minimize distraction in your brain during a marathon debugging
|
|
Packit Service |
c5cf8c |
# session that comes from manually decoding these values.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
use strict;
|
|
Packit Service |
c5cf8c |
use warnings;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# the order here matters
|
|
Packit Service |
c5cf8c |
my @kind_table = qw(
|
|
Packit Service |
c5cf8c |
INVALID
|
|
Packit Service |
c5cf8c |
COMM
|
|
Packit Service |
c5cf8c |
GROUP
|
|
Packit Service |
c5cf8c |
DATATYPE
|
|
Packit Service |
c5cf8c |
FILE
|
|
Packit Service |
c5cf8c |
ERRHANDLER
|
|
Packit Service |
c5cf8c |
OP
|
|
Packit Service |
c5cf8c |
INFO
|
|
Packit Service |
c5cf8c |
WIN
|
|
Packit Service |
c5cf8c |
KEYVAL
|
|
Packit Service |
c5cf8c |
ATTR
|
|
Packit Service |
c5cf8c |
REQUEST
|
|
Packit Service |
c5cf8c |
PROCGROUP
|
|
Packit Service |
c5cf8c |
VCONN
|
|
Packit Service |
c5cf8c |
WORKQ_ELEM
|
|
Packit Service |
c5cf8c |
GREQ_CLASS
|
|
Packit Service |
c5cf8c |
);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
my @type_table = qw(
|
|
Packit Service |
c5cf8c |
INVALID
|
|
Packit Service |
c5cf8c |
BUILTIN
|
|
Packit Service |
c5cf8c |
DIRECT
|
|
Packit Service |
c5cf8c |
INDIRECT
|
|
Packit Service |
c5cf8c |
);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
while (scalar @ARGV) {
|
|
Packit Service |
c5cf8c |
my $arg = shift @ARGV;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# handle the (common) case of a hex value instead of a decimal integer
|
|
Packit Service |
c5cf8c |
if ($arg =~ m/^0x[0-9a-fA-F]+$/) {
|
|
Packit Service |
c5cf8c |
$arg = hex $arg;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
my $kind = ($arg & 0x3c000000) >> 26;
|
|
Packit Service |
c5cf8c |
my $type = ($arg & 0xc0000000) >> 30;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if ($kind_table[$kind] eq "DATATYPE" and $type_table[$type] eq "BUILTIN") {
|
|
Packit Service |
c5cf8c |
my $datatype_size = ($arg & 0x0000ff00) >> 8;
|
|
Packit Service |
c5cf8c |
printf("value=0x%08x kind=0x%x (%10s) type=0x%x (%8s) size=%d (0x%x)\n", $arg, $kind, $kind_table[$kind], $type, $type_table[$type], $datatype_size, $datatype_size);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
else {
|
|
Packit Service |
c5cf8c |
printf("value=0x%08x kind=0x%x (%10s) type=0x%x (%8s)\n", $arg, $kind, $kind_table[$kind], $type, $type_table[$type]);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
## code from src/include/mpir_objects.h from which this script was derived
|
|
Packit Service |
c5cf8c |
## ----8<----
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## typedef enum MPII_Object_kind {
|
|
Packit Service |
c5cf8c |
## MPIR_COMM = 0x1,
|
|
Packit Service |
c5cf8c |
## MPIR_GROUP = 0x2,
|
|
Packit Service |
c5cf8c |
## MPIR_DATATYPE = 0x3,
|
|
Packit Service |
c5cf8c |
## MPIR_FILE = 0x4, /* This is not used */
|
|
Packit Service |
c5cf8c |
## MPIR_ERRHANDLER = 0x5,
|
|
Packit Service |
c5cf8c |
## MPIR_OP = 0x6,
|
|
Packit Service |
c5cf8c |
## MPIR_INFO = 0x7,
|
|
Packit Service |
c5cf8c |
## MPIR_WIN = 0x8,
|
|
Packit Service |
c5cf8c |
## MPID_KEYVAL = 0x9,
|
|
Packit Service |
c5cf8c |
## MPIR_ATTR = 0xa,
|
|
Packit Service |
c5cf8c |
## MPIR_REQUEST = 0xb,
|
|
Packit Service |
c5cf8c |
## MPIR_PROCGROUP = 0xc, /* These are internal device objects */
|
|
Packit Service |
c5cf8c |
## MPIR_VCONN = 0xd,
|
|
Packit Service |
c5cf8c |
## MPIR_WORKQ_ELEM = 0xe,
|
|
Packit Service |
c5cf8c |
## MPIR_GREQ_CLASS = 0xf
|
|
Packit Service |
c5cf8c |
## } MPII_Object_kind;
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## #define HANDLE_MPI_KIND_SHIFT 26
|
|
Packit Service |
c5cf8c |
## #define HANDLE_GET_MPI_KIND(a) ( ((a)&0x3c000000) >> HANDLE_MPI_KIND_SHIFT )
|
|
Packit Service |
c5cf8c |
## #define HANDLE_SET_MPI_KIND(a,kind) ((a) | ((kind) << HANDLE_MPI_KIND_SHIFT))
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## /* returns the name of the handle kind for debugging/logging purposes */
|
|
Packit Service |
c5cf8c |
## const char *MPIR_Handle_get_kind_str(int kind);
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## /* Handle types. These are really 2 bits */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_INVALID 0x0
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_BUILTIN 0x1
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_DIRECT 0x2
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_INDIRECT 0x3
|
|
Packit Service |
c5cf8c |
## /* Mask assumes that ints are at least 4 bytes */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_MASK 0xc0000000
|
|
Packit Service |
c5cf8c |
## #define HANDLE_KIND_SHIFT 30
|
|
Packit Service |
c5cf8c |
## #define HANDLE_GET_KIND(a) (((unsigned)(a)&HANDLE_KIND_MASK)>>HANDLE_KIND_SHIFT)
|
|
Packit Service |
c5cf8c |
## #define HANDLE_SET_KIND(a,kind) ((a)|((kind)<
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## /* For indirect, the remainder of the handle has a block and index */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_INDIRECT_SHIFT 16
|
|
Packit Service |
c5cf8c |
## #define HANDLE_BLOCK(a) (((a)& 0x03FF0000) >> HANDLE_INDIRECT_SHIFT)
|
|
Packit Service |
c5cf8c |
## #define HANDLE_BLOCK_INDEX(a) ((a) & 0x0000FFFF)
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## /* Handle block is between 1 and 1024 *elements* */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_BLOCK_SIZE 256
|
|
Packit Service |
c5cf8c |
## /* Index size is bewtween 1 and 65536 *elements* */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_BLOCK_INDEX_SIZE 1024
|
|
Packit Service |
c5cf8c |
##
|
|
Packit Service |
c5cf8c |
## /* For direct, the remainder of the handle is the index into a predefined
|
|
Packit Service |
c5cf8c |
## block */
|
|
Packit Service |
c5cf8c |
## #define HANDLE_MASK 0x03FFFFFF
|
|
Packit Service |
c5cf8c |
## #define HANDLE_INDEX(a) ((a)& HANDLE_MASK)
|
|
Packit Service |
c5cf8c |
## ----8<----
|