Commit f2019846 authored by Shane Snyder's avatar Shane Snyder

logutil definitions for pnetcdf module

parent 3b0dacf7
......@@ -61,10 +61,10 @@ darshan-hdf5-logutils.o: darshan-hdf5-logutils.c darshan-logutils.h darshan-hdf5
darshan-hdf5-logutils.po: darshan-hdf5-logutils.c darshan-logutils.h darshan-hdf5-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@
libdarshan-util.so: darshan-logutils.po darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po
libdarshan-util.so: darshan-logutils.po darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po darshan-pnetcdf-logutils.po
$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ $(LIBS)
libdarshan-util.a: darshan-logutils.o darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o
libdarshan-util.a: darshan-logutils.o darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o darshan-pnetcdf-logutils.o
ar rcs libdarshan-util.a $^
jenkins: util/bin/jenkins.o lookup3.o
......
......@@ -26,11 +26,11 @@ static int darshan_log_read(darshan_fd fd, void *buf, int len);
/* TODO: can we make this s.t. we don't care about ordering (i.e., X macro it ) */
struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] =
{
NULL, /* NULL */
NULL, /* NULL */
&posix_logutils, /* POSIX */
&mpiio_logutils, /* MPI-IO */
&hdf5_logutils, /* HDF5 */
NULL, /* PNETCDF */
&mpiio_logutils, /* MPI-IO */
&hdf5_logutils, /* HDF5 */
&pnetcdf_logutils, /* PNETCDF */
NULL,
NULL,
NULL,
......
......@@ -56,6 +56,7 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS];
#include "darshan-posix-logutils.h"
#include "darshan-mpiio-logutils.h"
#include "darshan-hdf5-logutils.h"
#include "darshan-pnetcdf-logutils.h"
darshan_fd darshan_log_open(const char *name, const char* mode);
int darshan_log_getheader(darshan_fd fd, struct darshan_header *header);
......
/*
* Copyright (C) 2015 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-pnetcdf-logutils.h"
/* counter name strings for the PNETCDF module */
#define X(a) #a,
char *pnetcdf_counter_names[] = {
PNETCDF_COUNTERS
};
char *pnetcdf_f_counter_names[] = {
PNETCDF_F_COUNTERS
};
#undef X
struct darshan_mod_logutil_funcs pnetcdf_logutils =
{
.log_get_record = &darshan_log_get_pnetcdf_file,
.log_print_record = &darshan_log_print_pnetcdf_file,
};
int darshan_log_get_pnetcdf_file(darshan_fd fd, void **file_rec,
darshan_record_id *rec_id)
{
int i;
int ret;
struct darshan_pnetcdf_file *file = NULL;
file = malloc(sizeof(*file));
if(!file)
return(-1);
memset(file, 0, sizeof(*file));
ret = darshan_log_get_moddat(fd, DARSHAN_PNETCDF_MOD,
(void *)file, sizeof(*file));
if(ret == 1)
{
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&file->f_id);
DARSHAN_BSWAP64(&file->rank);
for(i=0; i<PNETCDF_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->fcounters[i]);
}
}
/* pass the file record back */
*file_rec = (void *)file;
*rec_id = file->f_id;
return(ret);
}
void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
char *mnt_pt, char *fs_type)
{
int i;
struct darshan_pnetcdf_file *pnetcdf_file_rec =
(struct darshan_pnetcdf_file *)file_rec;
for(i=0; i<PNETCDF_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_counter_names[i],
pnetcdf_file_rec->counters[i], file_name, mnt_pt, fs_type);
}
for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
{
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_f_counter_names[i],
pnetcdf_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
}
return;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __DARSHAN_PNETCDF_LOG_UTILS_H
#define __DARSHAN_PNETCDF_LOG_UTILS_H
#include "darshan-logutils.h"
#include "darshan-pnetcdf-log-format.h"
extern char *pnetcdf_counter_names[];
extern char *pnetcdf_f_counter_names[];
extern struct darshan_mod_logutil_funcs pnetcdf_logutils;
int darshan_log_get_pnetcdf_file(darshan_fd fd, void **file_rec,
darshan_record_id *rec_id);
void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
char *mnt_pt, char *fs_type);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment