darshan-apxc-logutils.c 23 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[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[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[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[APXC_MOD] > 0) &&
        (fd->mod_ver[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[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, 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);
Kevin Harms's avatar
Kevin Harms committed
144 145 146 147
        return(-1);
    }
    else
    {
148 149
     //  *buf_p = NULL;
     //  if (buffer) free(buffer);
Kevin Harms's avatar
Kevin Harms committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
        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
166
        rec_len = sizeof(struct darshan_apxc_perf_record);
Kevin Harms's avatar
Kevin Harms committed
167
    
Sudheer Chunduri's avatar
Sudheer Chunduri committed
168 169
    ret = darshan_log_put_mod(fd, APXC_MOD, buf,
                              rec_len, APXC_VER);
Kevin Harms's avatar
Kevin Harms committed
170 171 172 173 174 175 176 177 178 179 180 181
    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;
182
    struct darshan_apxc_perf_record *prf_rec;
Kevin Harms's avatar
Kevin Harms committed
183 184 185

    if (first_rec)
    { 
186

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

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

    return;
}

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

272 273 274 275
    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
276

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

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

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

533 534
        int i;
        /* router tile record */
535
        for(i = 0; i < APXC_NUM_INDICES; i++)
536 537 538 539
        {
            if (!prf_rec2)
            {
                printf("- ");
Sudheer Chunduri's avatar
Sudheer Chunduri committed
540
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[APXC_MOD],
541 542 543 544 545 546 547
                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
548
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[APXC_MOD],
549 550 551 552 553 554 555
                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
556
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[APXC_MOD],
557 558 559 560 561
                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
562
                DARSHAN_U_COUNTER_PRINT(darshan_module_names[APXC_MOD],
563 564 565 566 567
                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
568 569 570 571 572 573 574 575 576 577 578 579 580
    }

    return;
}

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