Commit 1561ab23 authored by Shane Snyder's avatar Shane Snyder

Merge branch 'issue-218-val-counter' into 'master'

Issue 218 val counter

Closes #218

See merge request !6
parents 8babcd89 ace2260c
......@@ -10,6 +10,9 @@ Darshan-3.1.3-pre1
* skip instrumentation attempts for anonymous mmap() calls; this avoids a
potentential deadlock condition when used with hugepages on Cray systems.
Reported by Glenn Lockwood and Cristian Simarro.
* fix segmentation fault in statistics collection for applications that issue
operations with a large number of distince access sizes or strides on the
same file. Reported by Glenn Lockwood.
Darshan-3.1.2
=============
......
......@@ -267,9 +267,13 @@ void darshan_common_val_counter(void **common_val_root, int *common_val_count,
(*common_val_count)++;
}
/* update common access counters as we go */
DARSHAN_COMMON_VAL_COUNTER_INC(common_val_p, common_cnt_p,
found->val, found->freq, 1);
/* update common access counters as we go, as long as we haven't already
* hit the limit in the number we are willing to track */
if(found)
{
DARSHAN_COMMON_VAL_COUNTER_INC(common_val_p, common_cnt_p,
found->val, found->freq, 1);
}
return;
}
......
#!/bin/bash
PROG=access-size-counter-test
# set log file path; remove previous log if present
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
rm -f ${DARSHAN_LOGFILE}
# compile
$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
if [ $? -ne 0 ]; then
echo "Error: failed to compile ${PROG}" 1>&2
exit 1
fi
# execute
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
if [ $? -ne 0 ]; then
echo "Error: failed to execute ${PROG}" 1>&2
exit 1
fi
# parse log
$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
if [ $? -ne 0 ]; then
echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
exit 1
fi
# check results (for now just make sure it didn't crash)
exit 0
/*
* (C) 1995-2001 Clemson University and Argonne National Laboratory.
*
* See COPYING in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <mpi.h>
#include <errno.h>
#include <getopt.h>
/* DEFAULT VALUES FOR OPTIONS */
static char opt_file[256] = "test.out";
/* function prototypes */
static int parse_args(int argc, char **argv);
static void usage(void);
/* global vars */
static int mynod = 0;
static int nprocs = 1;
int main(int argc, char **argv)
{
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
char buffer[128] = {0};
int fd;
int i = 1;
int ret;
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
MPI_Get_processor_name(processor_name, &namelen);
/* parse the command line arguments */
parse_args(argc, argv);
if(mynod == 0)
{
fd = open(opt_file, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
if(fd<0)
{
perror("open");
return(-1);
}
/* cycle through a range of unique write access sizes */
for(i=1; i<128; i++)
{
ret = write(fd, buffer, i);
if(ret < 0)
{
perror("write");
return(-1);
}
if(ret != i)
{
fprintf(stderr, "Short write: %d\n", ret);
return(-1);
}
}
close(fd);
}
MPI_Finalize();
return(0);
}
static int parse_args(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "f:")) != EOF) {
switch (c) {
case 'f': /* filename */
strncpy(opt_file, optarg, 255);
break;
case '?': /* unknown */
if (mynod == 0)
usage();
exit(1);
default:
break;
}
}
return(0);
}
static void usage(void)
{
printf("Usage: stdio-test [<OPTIONS>...]\n");
printf("\n<OPTIONS> is one of\n");
printf(" -f filename [default: test.out]\n");
printf(" -h print this help\n");
}
/*
* Local variables:
* c-indent-level: 3
* c-basic-offset: 3
* tab-width: 3
*
* vim: ts=3
* End:
*/
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