148 fprintf(fs,
"[hdr:\n");
149 fprintf(fs,
" (version: %s)\n", hdr->
versionStr);
150 fprintf(fs,
" (endian: %c)\n", hdr->
endian);
202 uint64_t measurementGranularity,
206 va_start(args, measurementGranularity);
230 fprintf(fs,
"[epoch-hdr:\n");
231 fprintf(fs,
" (flags: 0x%"PRIx64
")\n", ehdr->
flags.
bits);
232 fprintf(fs,
" (measurement-granularity: %"PRIu64
")\n",
257 .flags.bits_big[0] = 0,
258 .flags.bits_big[1] = 0,
260 .properties = {.time = 0,.cycles = 0},
272 .fields.show = (uint8_t)
true,
273 .fields.showPercent = (uint8_t)
true,
294 memset(perf_info, 0, aux_info_size);
296 for (uint32_t i = 0; i < metric_tbl->len; i++) {
300 *aux_info = perf_info;
311 for (uint32_t i = 0; i < metric_tbl->len; i++) {
319 if (aux_info ==
NULL) {
321 info_ptr = &info_tmp;
323 info_ptr = &(aux_info[i]);
336 fprintf(fs,
"[metric-tbl: (num-entries: %u)\n", metric_tbl->len);
337 for (uint32_t i = 0; i < metric_tbl->len; i++) {
350 for (uint32_t i = 0; i < metric_tbl->len; i++) {
354 dealloc((
void*)metric_tbl->lst);
355 metric_tbl->lst =
NULL;
375 fseek(fs, -
sizeof(x->
flags), SEEK_CUR);
434 fprintf(fs,
"%s[(nm: %s) (desc: %s) " 435 "((ty: %d) (val-ty: %d) (val-fmt: %d) (partner: %u) (show: %d) (showPercent: %d)) " 436 "(period: %"PRIu64
") (formula: %s) (format: %s)\n" ,
443 fprintf(fs,
" (frequency: %d) (multiplexed: %d) (period-mean: %f) (num-samples: %d)]\n",
467 return (
double) metric.
i;
473 double *pointer_double = (
double*)metric.
p;
474 return *pointer_double;
486 metric->
i = (int) value;
493 double *ptr_double = (
double*) &value;
494 metric->
p = *(
void**) ptr_double;
538 for (uint32_t i = 0; i < loadmap->len; i++) {
551 for (uint32_t i = 0; i < loadmap->len; i++) {
563 fprintf(fs,
"[loadmap: (num-entries: %u)\n", loadmap->len);
564 for (uint32_t i = 0; i < loadmap->len; i++) {
577 for (uint32_t i = 0; i < loadmap->len; i++) {
581 dealloc(loadmap->lst);
612 fprintf(fs,
"%s[(id: %u) (nm: %s) (flg: 0x%"PRIx64
")]\n",
694 fprintf(fs,
"%s[node: (id: %d) (id-parent: %d) (type: %d) ",
701 fprintf(fs,
"(as: %s) ", as_str);
704 fprintf(fs,
"(lm-id: %u) (lm-ip: 0x%"PRIx64
") ", (
uint)x->
lm_id, x->
lm_ip);
712 fprintf(fs,
"%s(metrics:", pre);
717 mflags = mdesc->
flags;
723 fprintf(fs,
" %"PRIu64, x->
metrics[i].
i);
726 fprintf(fs,
" %g", x->
metrics[i].
r);
729 fprintf(fs,
" %p", x->
metrics[i].
p);
739 fprintf(fs,
"%s]\n", pre);
775 fprintf(fs,
"%s(lip: %s)", pre, lip_str);
837 const int bufSZ =
sizeof(flags);
838 unsigned char buf[bufSZ];
840 uint64_t flag_bits = flags.
bits;
842 for (
int shift = 56; shift >= 0; shift -= 8) {
843 buf[k] = (flag_bits >> shift) & 0xff;
886 fprintf(fs,
"[hdr:\n");
887 fprintf(fs,
" (version: %s)\n", hdr->
versionStr);
888 fprintf(fs,
" (endian: %c)\n", hdr->
endian);
889 fprintf(fs,
" (flags: 0x%"PRIx64
")\n", hdr->
flags.
bits);
931 unsigned char buf[bufSZ];
936 uint64_t time = x->
time;
937 for (shift = 56; shift >= 0; shift -= 8) {
938 buf[k] = (time >> shift) & 0xff;
942 uint32_t cpId = x->
cpId;
943 for (shift = 24; shift >= 0; shift -= 8) {
944 buf[k] = (cpId >> shift) & 0xff;
950 for (shift = 24; shift >= 0; shift -= 8) {
951 buf[k] = (metricId >> shift) & 0xff;
982 fprintf(fs,
"(%"PRIu64
", %u", x->
time, x->
cpId);
1060 fprintf(outfs,
"[hdr:...]\n");
1062 fprintf(outfs,
"(num-nodes: %u)\n", hdr->
numNodes);
1063 fprintf(outfs,
"(num-metrics: %u)\n", hdr->
numMetrics);
void hpcrun_fmt_epochHdr_free(hpcrun_fmt_epochHdr_t *ehdr, hpcfmt_free_fn dealloc)
int hpcrun_fmt_hdr_fprint(hpcrun_fmt_hdr_t *hdr, FILE *fs)
static const char HPCRUN_FMT_Magic[]
static const int HPCMETRICDB_FMT_MagicLen
static const int HPCTRACE_FMT_MagicLen
int hpcmetricDB_fmt_hdr_fread(hpcmetricDB_fmt_hdr_t *hdr, FILE *infs)
static struct perf_mem_metric metric
static const char HPCTRACE_FMT_Version[]
MetricFlags_ValFmt_t valFmt
ssize_t hpcio_outbuf_write(hpcio_outbuf_t *outbuf, const void *data, size_t size)
int hpctrace_fmt_datum_fwrite(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, FILE *outfs)
const metric_desc_t metricDesc_NULL
#define LUSH_LIP_DATA8_SZ
void hpcrun_fmt_metric_set_value_int(hpcrun_metricFlags_t *flags, hpcrun_metricVal_t *metric, int value)
void hpcfmt_free_fn(void *mem)
int hpctrace_fmt_hdr_fprint(hpctrace_fmt_hdr_t *hdr, FILE *fs)
int hpcfmt_nvpairList_fread(HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *infs, hpcfmt_alloc_fn alloc)
MetricFlags_ValTy_t valTy
static const int HPCMETRICDB_FMT_VersionLen
void hpcrun_fmt_metric_set_value_real(hpcrun_metricFlags_t *flags, hpcrun_metricVal_t *metric, double value)
MetricFlags_ValFmt_t valFmt
struct hpctrace_fmt_datum_t hpctrace_fmt_datum_t
int hpcrun_fmt_metricDesc_fread(metric_desc_t *x, metric_aux_info_t *aux_info, FILE *fs, double GCC_ATTR_UNUSED fmtVersion, hpcfmt_alloc_fn alloc)
static int hpcfmt_int2_fwrite(uint16_t val, FILE *outfs)
int hpcrun_fmt_lip_fread(lush_lip_t *x, FILE *fs)
int hpcrun_fmt_loadmapEntry_fprint(loadmap_entry_t *x, FILE *fs, const char *pre)
static int hpcfmt_int2_fread(uint16_t *val, FILE *infs)
void hpcrun_fmt_metricDesc_free(metric_desc_t *x, hpcfmt_free_fn dealloc)
int hpcrun_fmt_metricTbl_fprint(metric_tbl_t *metric_tbl, metric_aux_info_t *aux_info, FILE *fs)
int hpcrun_fmt_cct_node_fprint(hpcrun_fmt_cct_node_t *x, FILE *fs, epoch_flags_t flags, const metric_tbl_t *metricTbl, const char *pre)
static const char HPCRUN_FMT_EpochTag[]
static int hpcfmt_real8_fread(double *val, FILE *infs)
lush_assoc_info_t lush_assoc_info_NULL
static int hpcfmt_intX_fwrite(uint8_t *val, size_t size, FILE *outfs)
const hpcrun_metricFlags_t hpcrun_metricFlags_NULL
static const int HPCRUN_FMT_VersionLen
char versionStr[sizeof(HPCRUN_FMT_Version)]
static int hpcfmt_int4_fread(uint32_t *val, FILE *infs)
int hpctrace_fmt_datum_outbuf(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, hpcio_outbuf_t *outbuf)
hpcrun_metricVal_t hpcrun_metricVal_ZERO
static const int HPCMETRICDB_FMT_EndianLen
static const int HPCTRACE_FMT_VersionLen
static int hpcfmt_int4_fwrite(uint32_t val, FILE *outfs)
const hpctrace_hdr_flags_t hpctrace_hdr_flags_NULL
const char * lush_assoc_info_sprintf(char *str, lush_assoc_info_t as_info)
int hpcrun_fmt_cct_node_fread(hpcrun_fmt_cct_node_t *x, epoch_flags_t flags, FILE *fs)
char versionStr[sizeof(HPCMETRICDB_FMT_Version)]
int hpcrun_fmt_loadmap_fread(loadmap_t *loadmap, FILE *fs, hpcfmt_alloc_fn alloc)
static const char HPCMETRICDB_FMT_Magic[]
const char * lush_lip_sprintf(char *str, const lush_lip_t *x)
void hpcrun_fmt_metric_set_value_address(hpcrun_metricFlags_t *flags, hpcrun_metricVal_t *metric, double value)
int hpcrun_fmt_hdr_fwrite(FILE *fs,...)
hpcfmt_uint_t num_metrics
void hpcrun_fmt_loadmapEntry_free(loadmap_entry_t *x, hpcfmt_free_fn dealloc)
void hpcrun_fmt_metricTbl_free(metric_tbl_t *metric_tbl, hpcfmt_free_fn dealloc)
void hpcrun_fmt_loadmap_free(loadmap_t *loadmap, hpcfmt_free_fn dealloc)
int hpcrun_fmt_lip_fprint(lush_lip_t *x, FILE *fs, const char *pre)
int hpcrun_fmt_epochHdr_fprint(hpcrun_fmt_epochHdr_t *ehdr, FILE *fs)
int hpcrun_fmt_loadmap_fwrite(loadmap_t *loadmap, FILE *fs)
void hpcfmt_nvpairList_free(HPCFMT_List(hpcfmt_nvpair_t) *nvps, hpcfmt_free_fn dealloc)
static const int HPCRUN_FMT_EpochTagLen
#define LUSH_LIP_STR_MIN_LEN
hpcrun_metricFlags_fields fields
int hpcrun_fmt_metricTbl_fwrite(metric_desc_p_tbl_t *metric_tbl, metric_aux_info_t *aux_info, FILE *fs)
int hpcrun_fmt_metricDesc_fwrite(metric_desc_t *x, metric_aux_info_t *aux_info, FILE *fs)
static int hpcfmt_intX_fread(uint8_t *val, size_t size, FILE *infs)
size_t MONITOR_EXT_WRAP_NAME() fread(void *ptr, size_t size, size_t count, FILE *stream)
int hpcfmt_str_fwrite(const char *str, FILE *outfs)
int hpcfmt_nvpairs_vfwrite(FILE *out, va_list args)
lush_assoc_info_t as_info
struct metric_aux_info_s metric_aux_info_t
static const int HPCTRACE_FMT_EndianLen
static const int HPCRUN_FMT_MagicLen
static int hpcfmt_int8_fread(uint64_t *val, FILE *infs)
#define HPCRUN_FMT_MetricId_NULL
int hpcrun_fmt_lip_fwrite(lush_lip_t *x, FILE *fs)
int hpctrace_fmt_datum_fprint(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, FILE *fs)
static int hpcfmt_int8_fwrite(uint64_t val, FILE *outfs)
static void lush_lip_init(lush_lip_t *x)
#define HPCFMT_ThrowIfError(v)
epoch_flags_bitfield fields
static const char HPCMETRICDB_FMT_Endian[]
static const int HPCRUN_FMT_EndianLen
int hpcrun_fmt_loadmap_fprint(loadmap_t *loadmap, FILE *fs)
uint64_t measurementGranularity
int hpcrun_fmt_hdr_fread(hpcrun_fmt_hdr_t *hdr, FILE *infs, hpcfmt_alloc_fn alloc)
hpctrace_hdr_flags_bitfield fields
hpcrun_metricFlags_bitfield_XXX fields
void hpcfmt_str_free(const char *str, hpcfmt_free_fn dealloc)
int hpcrun_fmt_cct_node_fwrite(hpcrun_fmt_cct_node_t *x, epoch_flags_t flags, FILE *fs)
int hpcfmt_nvpairList_fprint(const HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *fs, const char *pre)
hpctrace_hdr_flags_t flags
void *MONITOR_EXT_WRAP_NAME() malloc(size_t bytes)
void * hpcfmt_alloc_fn(size_t nbytes)
int hpcrun_fmt_loadmapEntry_fwrite(loadmap_entry_t *x, FILE *fs)
int hpcrun_fmt_metricDesc_fprint(metric_desc_t *x, metric_aux_info_t *aux_info, FILE *fs, const char *pre)
int hpcrun_fmt_metricTbl_fread(metric_tbl_t *metric_tbl, metric_aux_info_t **aux_info, FILE *fs, double fmtVersion, hpcfmt_alloc_fn alloc)
static const char HPCMETRICDB_FMT_Version[]
char versionStr[sizeof(HPCTRACE_FMT_Version)]
size_t MONITOR_EXT_WRAP_NAME() fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
int hpcrun_fmt_epochHdr_fread(hpcrun_fmt_epochHdr_t *ehdr, FILE *fs, hpcfmt_alloc_fn alloc)
int hpctrace_fmt_hdr_fread(hpctrace_fmt_hdr_t *hdr, FILE *infs)
int hpctrace_fmt_hdr_outbuf(hpctrace_hdr_flags_t flags, hpcio_outbuf_t *outbuf)
#define LUSH_ASSOC_INFO_STR_MIN_LEN
static const char HPCTRACE_FMT_Magic[]
static int hpcfmt_real8_fwrite(double val, FILE *outfs)
static const char * hpcfmt_str_ensure(const char *x)
void hpcrun_fmt_hdr_free(hpcrun_fmt_hdr_t *hdr, hpcfmt_free_fn dealloc)
int hpctrace_fmt_datum_fread(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, FILE *fs)
int hpcmetricDB_fmt_hdr_fprint(hpcmetricDB_fmt_hdr_t *hdr, FILE *outfs)
static const char HPCTRACE_FMT_Endian[]
MetricFlags_ValTy_t valTy
int hpcrun_fmt_loadmapEntry_fread(loadmap_entry_t *x, FILE *fs, hpcfmt_alloc_fn alloc)
int hpcrun_fmt_epochHdr_fwrite(FILE *fs, epoch_flags_t flags, uint64_t measurementGranularity,...)
int hpcmetricDB_fmt_hdr_fwrite(hpcmetricDB_fmt_hdr_t *hdr, FILE *outfs)
static const char HPCRUN_FMT_Version[]
metric_desc_properties_t properties
void hpcrun_fmt_metric_set_value(metric_desc_t metric_desc, hpcrun_metricVal_t *metric, double value)
double hpcrun_fmt_metric_get_value(metric_desc_t metric_desc, hpcrun_metricVal_t metric)
static metric_desc_p_tbl_t metric_tbl
hpcrun_metricFlags_t flags
hpcrun_metricVal_t * metrics
uint64_t data8[LUSH_LIP_DATA8_SZ]
static const char HPCRUN_FMT_Endian[]
int hpctrace_fmt_hdr_fwrite(hpctrace_hdr_flags_t flags, FILE *fs)
int hpcfmt_str_fread(char **str, FILE *infs, hpcfmt_alloc_fn alloc)