darshan-apxc-logutils.c 23.6 KB
Newer Older
Kevin Harms's avatar
Kevin Harms committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * Copyright (C) 2018 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

#define _GNU_SOURCE
#include "darshan-util-config.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

#include "darshan-logutils.h"
#include "darshan-apxc-log-format.h"

/* counter name strings for the BGQ module */
#define X(a) #a,
char *apxc_counter_names[] = {
26
    APXC_PERF_COUNTERS
Kevin Harms's avatar
Kevin Harms committed
27
};
28 29
char *apxc_mmodes[] = { APXC_MEMORY_MODES };
char *apxc_cmodes[] = { APXC_CLUSTER_MODES };
Kevin Harms's avatar
Kevin Harms committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#undef X

static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p);
static int darshan_log_put_apxc_rec(darshan_fd fd, void* buf);
static void darshan_log_print_apxc_rec(void *file_rec,
    char *file_name, char *mnt_pt, char *fs_type);
static void darshan_log_print_apxc_description(int ver);
static void darshan_log_print_apxc_rec_diff(void *file_rec1, char *file_name1,
    void *file_rec2, char *file_name2);

struct darshan_mod_logutil_funcs apxc_logutils =
{
    .log_get_record = &darshan_log_get_apxc_rec,
    .log_put_record = &darshan_log_put_apxc_rec,
    .log_print_record = &darshan_log_print_apxc_rec,
    .log_print_description = &darshan_log_print_apxc_description,
    .log_print_diff = &darshan_log_print_apxc_rec_diff,
47
    .log_agg_records = NULL
Kevin Harms's avatar
Kevin Harms committed
48 49 50 51 52
};

static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
{
    struct darshan_apxc_header_record *hdr_rec;
53
    struct darshan_apxc_perf_record *prf_rec;
Kevin Harms's avatar
Kevin Harms committed
54
    int rec_len;
Philip Carns's avatar
bug fix  
Philip Carns committed
55
    char *buffer;
Kevin Harms's avatar
Kevin Harms committed
56 57 58 59
    int i;
    int ret = -1;
    static int first_rec = 1;

Sudheer Chunduri's avatar
Sudheer Chunduri committed
60
    if(fd->mod_map[DARSHAN_APXC_MOD].len == 0)
Kevin Harms's avatar
Kevin Harms committed
61 62 63 64 65
        return(0);

    if (!*buf_p)
    {
        /* assume this is the largest possible record size */
66
        buffer = malloc(sizeof(struct darshan_apxc_perf_record));
Kevin Harms's avatar
Kevin Harms committed
67 68 69 70 71 72 73 74 75 76
        if (!buffer)
        {
            return(-1);
        }
    }
    else
    {
        buffer = *buf_p;
    }

Sudheer Chunduri's avatar
Sudheer Chunduri committed
77
    if (fd->mod_ver[DARSHAN_APXC_MOD] == 0)
Kevin Harms's avatar
Kevin Harms committed
78 79
    {
        printf("Either unknown or debug version: %d\n",
Sudheer Chunduri's avatar
Sudheer Chunduri committed
80
               fd->mod_ver[DARSHAN_APXC_MOD]);
Kevin Harms's avatar
Kevin Harms committed
81 82 83
        return(0);
    }

Sudheer Chunduri's avatar
Sudheer Chunduri committed
84 85
    if ((fd->mod_ver[DARSHAN_APXC_MOD] > 0) &&
        (fd->mod_ver[DARSHAN_APXC_MOD] < APXC_VER))
Kevin Harms's avatar
Kevin Harms committed
86 87 88 89 90
    {
        /* perform conversion as needed */
    }

    /* v1, current version */
Sudheer Chunduri's avatar
Sudheer Chunduri committed
91
    if (fd->mod_ver[DARSHAN_APXC_MOD] == APXC_VER)
Kevin Harms's avatar
Kevin Harms committed
92 93 94 95 96 97 98
    {
        if (first_rec)
        {
            rec_len = sizeof(struct darshan_apxc_header_record);
            first_rec = 0;
        }
        else
99
            rec_len = sizeof(struct darshan_apxc_perf_record);
Kevin Harms's avatar
Kevin Harms committed
100

Sudheer Chunduri's avatar
Sudheer Chunduri committed
101
        ret = darshan_log_get_mod(fd, DARSHAN_APXC_MOD, buffer, rec_len);
Kevin Harms's avatar
Kevin Harms committed
102 103 104 105 106 107 108 109 110 111 112 113
    }

    if (ret == rec_len)
    {
        if(fd->swap_flag)
        {
            if (rec_len == sizeof(struct darshan_apxc_header_record))
            {
                hdr_rec = (struct darshan_apxc_header_record*)buffer; 
                /* swap bytes if necessary */
                DARSHAN_BSWAP64(&(hdr_rec->base_rec.id));
                DARSHAN_BSWAP64(&(hdr_rec->base_rec.rank));
114 115 116 117 118
                DARSHAN_BSWAP32(&(hdr_rec->nblades));
                DARSHAN_BSWAP32(&(hdr_rec->nchassis));
                DARSHAN_BSWAP32(&(hdr_rec->ngroups));
                DARSHAN_BSWAP32(&(hdr_rec->memory_mode));
                DARSHAN_BSWAP32(&(hdr_rec->cluster_mode));
119
                DARSHAN_BSWAP64(&(hdr_rec->appid));
Kevin Harms's avatar
Kevin Harms committed
120 121 122
            }
            else
            {
123 124 125 126 127 128 129
                prf_rec = (struct darshan_apxc_perf_record*)buffer;
                DARSHAN_BSWAP64(&(prf_rec->base_rec.id));
                DARSHAN_BSWAP64(&(prf_rec->base_rec.rank));
                DARSHAN_BSWAP64(&(prf_rec->group));
                DARSHAN_BSWAP64(&(prf_rec->chassis));
                DARSHAN_BSWAP64(&(prf_rec->blade));
                DARSHAN_BSWAP64(&(prf_rec->node));
130
                for (i = 0; i < APXC_NUM_INDICES; i++)
Kevin Harms's avatar
Kevin Harms committed
131
                {
132
                    DARSHAN_BSWAP64(&prf_rec->counters[i]);
Kevin Harms's avatar
Kevin Harms committed
133 134 135 136 137 138 139 140
                }
            }
        }
        *buf_p = buffer;
        return(1);
    }
    else if (ret < 0)
    {
141 142
     //*buf_p = NULL;
     //  if (buffer) free(buffer);
Kevin Harms's avatar
Kevin Harms committed
143 144 145 146
        return(-1);
    }
    else
    {
147 148
     //  *buf_p = NULL;
     //  if (buffer) free(buffer);
Kevin Harms's avatar
Kevin Harms committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
        return(0);
    }
}

static int darshan_log_put_apxc_rec(darshan_fd fd, void* buf)
{
    int ret;
    int rec_len;
    static int first_rec = 1;

    if (first_rec)
    {
        rec_len = sizeof(struct darshan_apxc_header_record);
        first_rec = 0;
    }
    else
165
        rec_len = sizeof(struct darshan_apxc_perf_record);
Kevin Harms's avatar
Kevin Harms committed
166
    
Sudheer Chunduri's avatar
Sudheer Chunduri committed
167
    ret = darshan_log_put_mod(fd, DARSHAN_APXC_MOD, buf,
Sudheer Chunduri's avatar
Sudheer Chunduri committed
168
                              rec_len, APXC_VER);
Kevin Harms's avatar
Kevin Harms committed
169 170 171 172 173 174 175 176 177 178 179 180
    if(ret < 0)
        return(-1);

    return(0);
}

static void darshan_log_print_apxc_rec(void *rec, char *file_name,
    char *mnt_pt, char *fs_type)
{
    int i;
    static int first_rec = 1;
    struct darshan_apxc_header_record *hdr_rec;
181
    struct darshan_apxc_perf_record *prf_rec;
Kevin Harms's avatar
Kevin Harms committed
182 183 184

    if (first_rec)
    { 
185

Kevin Harms's avatar
Kevin Harms committed
186
        hdr_rec = rec;
Sudheer Chunduri's avatar
Sudheer Chunduri committed
187
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
188
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
189
            "groups", hdr_rec->ngroups, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
190
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
191
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
192
            "chassis", hdr_rec->nchassis, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
193
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
194
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
195
            "blades", hdr_rec->nblades, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
196
        DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
197
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
198
            "memory_mode", apxc_mmodes[hdr_rec->memory_mode & ~(1<<31)], "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
199
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
200 201
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
            "memory_mode_consistent", ((hdr_rec->memory_mode & (1<<31)) == 0), "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
202
        DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
203
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
204
            "cluster_mode", apxc_cmodes[hdr_rec->cluster_mode & ~(1<<31)], "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
205
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
206 207
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
            "cluster_mode_consistent", ((hdr_rec->cluster_mode & (1<<31)) == 0), "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
208
        DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
209 210
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
            "application_id", hdr_rec->appid, "", "", "");
Kevin Harms's avatar
Kevin Harms committed
211 212 213 214
        first_rec = 0;
    }
    else
    {
215 216
        prf_rec = rec;
        
Sudheer Chunduri's avatar
Sudheer Chunduri committed
217
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
218 219
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
            "GROUP", prf_rec->group, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
220
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
221 222
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
            "CHASSIS", prf_rec->chassis, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
223
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
224 225
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
            "BLADE", prf_rec->blade, "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
226
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
227 228
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
            "NODE", prf_rec->node, "", "", "");
Kevin Harms's avatar
Kevin Harms committed
229

230
        for(i = 0; i < APXC_NUM_INDICES; i++)
Kevin Harms's avatar
Kevin Harms committed
231
        {
Sudheer Chunduri's avatar
Sudheer Chunduri committed
232
            DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
233 234
                prf_rec->base_rec.rank, prf_rec->base_rec.id,
                apxc_counter_names[i], prf_rec->counters[i],
235
                "", "", "");
Kevin Harms's avatar
Kevin Harms committed
236 237 238 239 240 241 242 243 244
        }
    }

    return;
}

static void darshan_log_print_apxc_description(int ver)
{
    printf("\n# description of APXC counters: %d\n", ver);
245 246 247 248 249 250 251
    printf("#   groups: total number of groups\n");
    printf("#   chassis: total number of chassis\n");
    printf("#   blades: total number of blades\n");
    printf("#   memory_mode: Intel Xeon memory mode\n");
    printf("#   cluster_mode: Intel Xeon NUMA configuration\n");
    printf("#   memory_mode_consistent: Intel Xeon memory mode consistent across all nodes\n");
    printf("#   cluster_mode_consistent: Intel Xeon cluster mode consistent across all nodes\n");
Kevin Harms's avatar
Kevin Harms committed
252
    printf("#   router:\n");
253 254 255 256 257
    printf("#     group:   group this router is on\n");
    printf("#     chassis: chassies this router is on\n");
    printf("#     blade:   blade this router is on\n");
    printf("#     node:    node connected to this router\n");
    printf("#     AR_RTR_x_y_INQ_PRF_INCOMING_FLIT_VC[0-7]: flits on VCz of x y tile\n");
Kevin Harms's avatar
Kevin Harms committed
258 259 260 261 262 263 264 265
    printf("#     AR_RTR_x_y_INQ_PRF_ROWBUS_STALL_CNT: stalls on x y tile\n");

    return;
}

static void darshan_log_print_apxc_rec_diff(void *file_rec1, char *file_name1,
    void *file_rec2, char *file_name2)
{
266 267 268 269
    struct darshan_apxc_header_record *hdr_rec1;
    struct darshan_apxc_header_record *hdr_rec2;
    struct darshan_apxc_perf_record   *prf_rec1;
    struct darshan_apxc_perf_record   *prf_rec2;
Kevin Harms's avatar
Kevin Harms committed
270

271 272 273 274
    hdr_rec1 = (struct darshan_apxc_header_record*) file_rec1;
    hdr_rec2 = (struct darshan_apxc_header_record*) file_rec2;
    prf_rec1 = (struct darshan_apxc_perf_record*) file_rec1;
    prf_rec2 = (struct darshan_apxc_perf_record*) file_rec2;
Kevin Harms's avatar
Kevin Harms committed
275

Sudheer Chunduri's avatar
Sudheer Chunduri committed
276
    if (hdr_rec1->magic == APXC_MAGIC)
277 278 279 280 281
    {
        /* this is the header record */
        if (!hdr_rec2)
        {
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
282
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
283 284 285
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "groups", hdr_rec1->ngroups, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
286
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
287 288 289
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "chassis", hdr_rec1->nchassis, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
290
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
291 292 293
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "blades", hdr_rec1->nblades, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
294
            DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
295
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
296
                "memory_mode", apxc_mmodes[hdr_rec1->memory_mode & ~(1<<31)], "", "", "");
297
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
298
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
299 300 301
            hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
            "memory_mode_consistent", ((hdr_rec1->memory_mode & (1<<31)) == 0), "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
302
            DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
303
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
304
                "cluster_mode", apxc_cmodes[hdr_rec1->cluster_mode & ~(1<<31)], "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
305
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
306 307
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "cluster_mode_consistent", ((hdr_rec1->cluster_mode & (1<<31)) == 0), "", "", "");
308
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
309
            DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
310 311
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "appid", hdr_rec1->appid, "", "", "");
312 313 314 315
        }
        else if (!hdr_rec1)
        {
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
316
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
317 318 319
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "groups", hdr_rec2->ngroups, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
320
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
321 322 323
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "chassis", hdr_rec2->nchassis, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
324
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
325 326 327
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "blades", hdr_rec2->nblades, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
328
            DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
329
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
330
                "memory_mode", apxc_mmodes[hdr_rec2->memory_mode & ~(1<<31)], "", "", "");
331
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
332
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
333 334 335
            hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
            "memory_mode_consistent", ((hdr_rec2->memory_mode & (1<<31)) == 0), "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
336
            DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
337
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
338
                "cluster_mode", apxc_cmodes[hdr_rec2->cluster_mode & ~(1<<31)], "", "", "");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
339
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
340 341
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "cluster_mode_consistent", ((hdr_rec2->cluster_mode & (1<<31)) == 0), "", "", "");
342
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
343
            DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
344 345
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "appid", hdr_rec2->appid, "", "", "");
346 347 348 349 350 351
        }
        else
        {
            if (hdr_rec1->ngroups != hdr_rec2->ngroups)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
352
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
353 354 355
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "groups", hdr_rec1->ngroups, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
356
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
357 358 359 360 361 362
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "groups", hdr_rec2->ngroups, "", "", "");
            }
            if (hdr_rec1->nchassis != hdr_rec2->nchassis)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
363
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
364 365 366
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "chassis", hdr_rec1->nchassis, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
367
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
368 369 370 371 372 373
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "chassis", hdr_rec2->nchassis, "", "", "");
            }
            if (hdr_rec1->nblades != hdr_rec2->nblades)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
374
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
375 376 377 378
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "blades", hdr_rec1->nblades, "", "", "");

                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
379
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
380 381 382 383 384 385 386
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "blades", hdr_rec2->nblades, "", "", "");
            }
            if ((hdr_rec1->memory_mode & ~(1<<31)) != 
                (hdr_rec2->memory_mode &  ~(1<<31)))
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
387
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
388
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
389
                "memory_mode", apxc_mmodes[hdr_rec1->memory_mode & ~(1<<31)], "", "", "");
390
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
391
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
392
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
393
                "memory_mode", apxc_mmodes[hdr_rec2->memory_mode & ~(1<<31)], "", "", "");
394 395 396 397 398
            }
            if ((hdr_rec1->memory_mode & (1<<31)) !=
                (hdr_rec2->memory_mode & (1<<31)))
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
399
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
400 401 402
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "memory_mode_consistent", ((hdr_rec1->memory_mode & (1<<31)) == 0), "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
403
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
404 405 406 407 408 409 410
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "memory_mode_consistent", ((hdr_rec2->memory_mode & (1<<31)) == 0), "", "", "");
            }
            if ((hdr_rec1->cluster_mode & ~(1<<31)) !=
                (hdr_rec2->cluster_mode & ~(1<<31)))
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
411
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
412
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
413
                "cluster_mode", apxc_cmodes[hdr_rec1->cluster_mode & ~(1<<31)], "", "", "");
414
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
415
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
416
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
417
                "cluster_mode", apxc_cmodes[hdr_rec2->cluster_mode & ~(1<<31)], "", "", "");
418 419 420 421 422
            }
            if ((hdr_rec1->cluster_mode & (1<<31)) !=
                (hdr_rec2->cluster_mode & (1<<31)))
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
423
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
424 425 426
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "cluster_mode_consistent", ((hdr_rec1->cluster_mode & (1<<31)) == 0), "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
427
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
428 429 430
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "cluster_mode_consistent", ((hdr_rec2->cluster_mode & (1<<31)) == 0), "", "", "");
            }
431 432 433
            if (hdr_rec1->appid != hdr_rec2->appid)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
434
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
435 436 437 438
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
                "application_id", hdr_rec1->appid, "", "", "");

                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
439
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
440 441 442
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
                "application_id", hdr_rec2->appid, "", "", "");
            }
443 444 445
        }
    }
    else
Kevin Harms's avatar
Kevin Harms committed
446
    {
447 448 449
        if (!prf_rec2)
        {
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
450
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
451 452 453
                    prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                    "GROUP", prf_rec1->group, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
454
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
455 456 457
                    prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                    "CHASSIS", prf_rec1->chassis, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
458
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
459 460 461
                    prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                    "BLADE", prf_rec1->blade, "", "", "");
            printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
462
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
463 464 465 466 467 468
                    prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                    "NODE", prf_rec1->node, "", "", "");
        }
        else if (!prf_rec1)
        {
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
469
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
470 471 472
                    prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                    "GROUP", prf_rec2->group, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
473
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
474 475 476
                    prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                    "CHASSIS", prf_rec2->chassis, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
477
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
478 479 480
                    prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                    "BLADE", prf_rec2->blade, "", "", "");
            printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
481
            DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
482 483 484 485 486 487 488
                    prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                    "NODE", prf_rec2->node, "", "", "");
        }
        else {
            if (prf_rec1->group != prf_rec2->group)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
489
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
490 491 492
                        prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                        "GROUP", prf_rec1->group, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
493
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
494 495 496 497 498 499
                        prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                        "GROUP", prf_rec2->group, "", "", "");
            }
            if (prf_rec1->chassis != prf_rec2->chassis)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
500
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
501 502 503
                        prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                        "CHASSIS", prf_rec1->chassis, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
504
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
505 506 507 508 509 510
                        prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                        "CHASSIS", prf_rec2->chassis, "", "", "");
            }
            if (prf_rec1->blade != prf_rec2->blade)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
511
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
512 513 514
                        prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                        "BLADE", prf_rec1->blade, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
515
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
516 517 518 519 520 521
                        prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                        "BLADE", prf_rec2->blade, "", "", "");
            }
            if (prf_rec1->node != prf_rec2->node)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
522
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
523 524 525
                        prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                        "NODE", prf_rec1->node, "", "", "");
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
526
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
527 528 529 530 531
                        prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                        "NODE", prf_rec2->node, "", "", "");
            }
        } 

532 533
        int i;
        /* router tile record */
534
        for(i = 0; i < APXC_NUM_INDICES; i++)
535 536 537 538
        {
            if (!prf_rec2)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
539
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
540 541 542 543 544 545 546
                prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                apxc_counter_names[i], prf_rec1->counters[i],
                "", "", "");
            }
            else if (!prf_rec1)
            {
                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
547
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
548 549 550 551 552 553 554
                prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                apxc_counter_names[i], prf_rec2->counters[i],
                "", "", "");
            }
            else if (prf_rec1->counters[i] != prf_rec2->counters[i])
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
555
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
556 557 558 559 560
                prf_rec1->base_rec.rank, prf_rec1->base_rec.id,
                apxc_counter_names[i], prf_rec1->counters[i],
                "", "", "");

                printf("+ ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
561
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
562 563 564 565 566
                prf_rec2->base_rec.rank, prf_rec2->base_rec.id,
                apxc_counter_names[i], prf_rec2->counters[i],
                "", "", "");
            }
        }
Kevin Harms's avatar
Kevin Harms committed
567 568 569 570 571 572 573 574 575 576 577 578 579
    }

    return;
}

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ts=8 sts=4 sw=4 expandtab
 */