darshan-apxc-logutils.c 24.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
/*
 * 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"

23 24 25
/* counter name strings for the APXC module */
#define Y(a) #a,
#define X(a) Y(APXC_ ## a)
Kevin Harms's avatar
Kevin Harms committed
26
char *apxc_counter_names[] = {
27
    APXC_PERF_COUNTERS
Kevin Harms's avatar
Kevin Harms committed
28
};
29 30 31
#undef Y
#undef X
#define X(a) #a,
32 33
char *apxc_mmodes[] = { APXC_MEMORY_MODES };
char *apxc_cmodes[] = { APXC_CLUSTER_MODES };
Kevin Harms's avatar
Kevin Harms committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#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,
51
    .log_agg_records = NULL
Kevin Harms's avatar
Kevin Harms committed
52 53 54 55 56
};

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

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

Shane Snyder's avatar
Shane Snyder committed
67 68 69 70 71 72 73 74
    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
75 76 77
    if (!*buf_p)
    {
        /* assume this is the largest possible record size */
78
        buffer = malloc(sizeof(struct darshan_apxc_perf_record));
Kevin Harms's avatar
Kevin Harms committed
79 80 81 82 83 84 85 86 87 88
        if (!buffer)
        {
            return(-1);
        }
    }
    else
    {
        buffer = *buf_p;
    }

Shane Snyder's avatar
Shane Snyder committed
89
    if (fd->mod_ver[DARSHAN_APXC_MOD] < APXC_VER)
Kevin Harms's avatar
Kevin Harms committed
90 91 92 93 94
    {
        /* perform conversion as needed */
    }

    /* v1, current version */
Shane Snyder's avatar
Shane Snyder committed
95
    if (fd->mod_ver[DARSHAN_APXC_MOD] == APXC_VER)
Kevin Harms's avatar
Kevin Harms committed
96 97 98 99 100 101 102
    {
        if (first_rec)
        {
            rec_len = sizeof(struct darshan_apxc_header_record);
            first_rec = 0;
        }
        else
103
            rec_len = sizeof(struct darshan_apxc_perf_record);
Kevin Harms's avatar
Kevin Harms committed
104

Shane Snyder's avatar
Shane Snyder committed
105
        ret = darshan_log_get_mod(fd, DARSHAN_APXC_MOD, buffer, rec_len);
Kevin Harms's avatar
Kevin Harms committed
106 107 108 109 110 111 112 113 114 115 116 117
    }

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

    if (first_rec)
    { 
192

Kevin Harms's avatar
Kevin Harms committed
193
        hdr_rec = rec;
Shane Snyder's avatar
Shane Snyder committed
194
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
195
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
196
            "APXC_GROUPS", hdr_rec->ngroups, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
197
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
198
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
199
            "APXC_CHASSIS", hdr_rec->nchassis, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
200
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
Kevin Harms's avatar
Kevin Harms committed
201
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
202
            "APXC_BLADES", hdr_rec->nblades, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
203
        DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
204
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
205
            "APXC_MEMORY_MODE", apxc_mmodes[hdr_rec->memory_mode & ~(1<<31)], "", "", "");
Shane Snyder's avatar
Shane Snyder committed
206
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
207
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
208
            "APXC_MEMORY_MODE_CONSISTENT", ((hdr_rec->memory_mode & (1<<31)) == 0), "", "", "");
Shane Snyder's avatar
Shane Snyder committed
209
        DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
210
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
211
            "APXC_CLUSTER_MODE", apxc_cmodes[hdr_rec->cluster_mode & ~(1<<31)], "", "", "");
Shane Snyder's avatar
Shane Snyder committed
212
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
213
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
214
            "APXC_CLUSTER_MODE_CONSISTENT", ((hdr_rec->cluster_mode & (1<<31)) == 0), "", "", "");
Shane Snyder's avatar
Shane Snyder committed
215
        DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
216
            hdr_rec->base_rec.rank, hdr_rec->base_rec.id,
217
            "APXC_APPLICATION_ID", hdr_rec->appid, "", "", "");
Kevin Harms's avatar
Kevin Harms committed
218 219 220 221
        first_rec = 0;
    }
    else
    {
222 223
        prf_rec = rec;
        
Shane Snyder's avatar
Shane Snyder committed
224
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
225
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
226
            "APXC_GROUP", prf_rec->group, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
227
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
228
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
229
            "APXC_CHASSIS", prf_rec->chassis, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
230
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
231
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
232
            "APXC_BLADE", prf_rec->blade, "", "", "");
Shane Snyder's avatar
Shane Snyder committed
233
        DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
234
            prf_rec->base_rec.rank, prf_rec->base_rec.id,
235
            "APXC_NODE", prf_rec->node, "", "", "");
Kevin Harms's avatar
Kevin Harms committed
236

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

    return;
}

static void darshan_log_print_apxc_description(int ver)
{
252 253 254 255 256 257 258 259 260 261
    printf("\n# description of APXC counters:\n");
    printf("#   global summary stats for the APXC module:\n");
    printf("#     APXC_GROUPS: total number of groups\n");
    printf("#     APXC_CHASSIS: total number of chassis\n");
    printf("#     APXC_BLADES: total number of blades\n");
    printf("#     APXC_MEMORY_MODE: Intel Xeon memory mode\n");
    printf("#     APXC_CLUSTER_MODE: Intel Xeon NUMA configuration\n");
    printf("#     APXC_MEMORY_MODE_CONSISTENT: Intel Xeon memory mode consistent across all nodes\n");
    printf("#     APXC_CLUSTER_MODE_CONSISTENT: Intel Xeon cluster mode consistent across all nodes\n");
    printf("#   per-router statistics for the APXC module:\n");
262 263 264 265
    printf("#     APXC_GROUP:   group this router is on\n");
    printf("#     APXC_CHASSIS: chassies this router is on\n");
    printf("#     APXC_BLADE:   blade this router is on\n");
    printf("#     APXC_NODE:    node connected to this router\n");
266
    printf("#     APXC_AR_RTR_* port counters for the 40 router-router ports\n");
267 268
    printf("#     APXC_AR_RTR_x_y_INQ_PRF_INCOMING_FLIT_VC[0-7]: flits on VCs of x y tile\n");
    printf("#     APXC_AR_RTR_x_y_INQ_PRF_ROWBUS_STALL_CNT: stalls on x y tile\n");
269 270
    printf("#     APXC_AR_RTR_PT_* port counters for the 8 router-nic ports\n");
    printf("#     APXC_AR_RTR_PT_x_y_INQ_PRF_INCOMING_FLIT_VC[0,4]: flits on VCs of x y tile\n");
271
    printf("#     APXC_AR_RTR_PT_x_y_INQ_PRF_REQ_ROWBUS_STALL_CNT: stalls on x y tile\n"); 
Kevin Harms's avatar
Kevin Harms committed
272 273 274 275 276 277 278

    return;
}

static void darshan_log_print_apxc_rec_diff(void *file_rec1, char *file_name1,
    void *file_rec2, char *file_name2)
{
279 280 281 282
    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
283

284 285 286 287
    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
288

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

                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
392
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
393
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
394
                "APXC_BLADES", hdr_rec2->nblades, "", "", "");
395 396 397 398 399
            }
            if ((hdr_rec1->memory_mode & ~(1<<31)) != 
                (hdr_rec2->memory_mode &  ~(1<<31)))
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
400
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
401
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
402
                "APXC_MEMORY_MODE", apxc_mmodes[hdr_rec1->memory_mode & ~(1<<31)], "", "", "");
403
                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
404
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
405
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
406
                "APXC_MEMORY_MODE", apxc_mmodes[hdr_rec2->memory_mode & ~(1<<31)], "", "", "");
407 408 409 410 411
            }
            if ((hdr_rec1->memory_mode & (1<<31)) !=
                (hdr_rec2->memory_mode & (1<<31)))
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
412
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
413
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
414
                "APXC_MEMORY_MODE_CONSISTENT", ((hdr_rec1->memory_mode & (1<<31)) == 0), "", "", "");
415
                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
416
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
417
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
418
                "APXC_MEMORY_MODE_CONSISTENT", ((hdr_rec2->memory_mode & (1<<31)) == 0), "", "", "");
419 420 421 422 423
            }
            if ((hdr_rec1->cluster_mode & ~(1<<31)) !=
                (hdr_rec2->cluster_mode & ~(1<<31)))
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
424
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
425
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
426
                "APXC_CLUSTER_MODE", apxc_cmodes[hdr_rec1->cluster_mode & ~(1<<31)], "", "", "");
427
                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
428
                DARSHAN_S_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
429
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
430
                "APXC_CLUSTER_MODE", apxc_cmodes[hdr_rec2->cluster_mode & ~(1<<31)], "", "", "");
431 432 433 434 435
            }
            if ((hdr_rec1->cluster_mode & (1<<31)) !=
                (hdr_rec2->cluster_mode & (1<<31)))
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
436
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
437
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
438
                "APXC_CLUSTER_MODE_CONSISTENT", ((hdr_rec1->cluster_mode & (1<<31)) == 0), "", "", "");
439
                printf("+ ");
Shane Snyder's avatar
Shane Snyder committed
440
                DARSHAN_I_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
441
                hdr_rec2->base_rec.rank, hdr_rec2->base_rec.id,
442
                "APXC_CLUSTER_MODE_CONSISTENT", ((hdr_rec2->cluster_mode & (1<<31)) == 0), "", "", "");
443
            }
444 445 446
            if (hdr_rec1->appid != hdr_rec2->appid)
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
447
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
448
                hdr_rec1->base_rec.rank, hdr_rec1->base_rec.id,
449
                "APXC_APPLICATION_ID", hdr_rec1->appid, "", "", "");
450 451

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

545 546
        int i;
        /* router tile record */
547
        for(i = 0; i < APXC_NUM_INDICES; i++)
548 549 550 551
        {
            if (!prf_rec2)
            {
                printf("- ");
Shane Snyder's avatar
Shane Snyder committed
552
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
553 554 555 556 557 558 559
                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
560
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
561 562 563 564 565 566 567
                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
568
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
569 570 571 572 573
                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
574
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[DARSHAN_APXC_MOD],
575 576 577 578 579
                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
580 581 582 583 584 585 586 587 588 589 590 591 592
    }

    return;
}

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