darshan-apxc-logutils.c 23.7 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;

Shane Snyder's avatar
Shane Snyder committed
60
    if(fd->mod_map[DARSHAN_APXC_MOD].len == 0)
Kevin Harms's avatar
Kevin Harms committed
61 62
        return(0);

Shane Snyder's avatar
Shane Snyder committed
63 64 65 66 67 68 69 70
    if(fd->mod_ver[DARSHAN_APXC_MOD] == 0 ||
        fd->mod_ver[DARSHAN_APXC_MOD] > APXC_VER)
    {
        fprintf(stderr, "Error: Invalid APXC module version number (got %d)\n",
            fd->mod_ver[DARSHAN_APXC_MOD]);
        return(-1);
    }

Kevin Harms's avatar
Kevin Harms committed
71 72 73
    if (!*buf_p)
    {
        /* assume this is the largest possible record size */
74
        buffer = malloc(sizeof(struct darshan_apxc_perf_record));
Kevin Harms's avatar
Kevin Harms committed
75 76 77 78 79 80 81 82 83 84
        if (!buffer)
        {
            return(-1);
        }
    }
    else
    {
        buffer = *buf_p;
    }

Shane Snyder's avatar
Shane Snyder committed
85
    if (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 */
Shane Snyder's avatar
Shane Snyder 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

Shane Snyder's avatar
Shane Snyder 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));
Shane Snyder's avatar
Shane Snyder committed
114 115 116 117 118 119
                DARSHAN_BSWAP64(&(hdr_rec->magic));
                DARSHAN_BSWAP64(&(hdr_rec->nblades));
                DARSHAN_BSWAP64(&(hdr_rec->nchassis));
                DARSHAN_BSWAP64(&(hdr_rec->ngroups));
                DARSHAN_BSWAP64(&(hdr_rec->memory_mode));
                DARSHAN_BSWAP64(&(hdr_rec->cluster_mode));
120
                DARSHAN_BSWAP64(&(hdr_rec->appid));
Kevin Harms's avatar
Kevin Harms committed
121 122 123
            }
            else
            {
124 125 126 127 128 129 130
                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));
131
                for (i = 0; i < APXC_NUM_INDICES; i++)
Kevin Harms's avatar
Kevin Harms committed
132
                {
133
                    DARSHAN_BSWAP64(&prf_rec->counters[i]);
Kevin Harms's avatar
Kevin Harms committed
134 135 136 137 138 139 140 141
                }
            }
        }
        *buf_p = buffer;
        return(1);
    }
    else if (ret < 0)
    {
142 143
     //*buf_p = NULL;
     //  if (buffer) free(buffer);
Shane Snyder's avatar
Shane Snyder committed
144
        if (!*buf_p) free(buffer);
Kevin Harms's avatar
Kevin Harms committed
145 146 147 148
        return(-1);
    }
    else
    {
149 150
     //  *buf_p = NULL;
     //  if (buffer) free(buffer);
Shane Snyder's avatar
Shane Snyder committed
151
        if (!*buf_p) free(buffer);
Kevin Harms's avatar
Kevin Harms committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
        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
168
        rec_len = sizeof(struct darshan_apxc_perf_record);
Kevin Harms's avatar
Kevin Harms committed
169
    
Shane Snyder's avatar
Shane Snyder committed
170
    ret = darshan_log_put_mod(fd, DARSHAN_APXC_MOD, buf,
Sudheer Chunduri's avatar
Sudheer Chunduri committed
171
                              rec_len, APXC_VER);
Kevin Harms's avatar
Kevin Harms committed
172 173 174 175 176 177 178 179 180 181 182 183
    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;
184
    struct darshan_apxc_perf_record *prf_rec;
Kevin Harms's avatar
Kevin Harms committed
185 186 187

    if (first_rec)
    { 
188

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

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

    return;
}

static void darshan_log_print_apxc_description(int ver)
{
    printf("\n# description of APXC counters: %d\n", ver);
248 249 250 251 252 253 254
    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
255
    printf("#   router:\n");
256 257 258 259 260
    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
261 262 263 264 265 266 267 268
    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)
{
269 270 271 272
    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
273

274 275 276 277
    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
278

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

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

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

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

                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
564
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
565 566 567 568 569
                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
570 571 572 573 574 575 576 577 578 579 580 581 582
    }

    return;
}

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