diff --git a/codes/codeslogging.h b/codes/codeslogging.h deleted file mode 100644 index fbbe1885c59fcd4e2802cd7d14ea06eaba9ab8b6..0000000000000000000000000000000000000000 --- a/codes/codeslogging.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2013 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - */ - -/* - * (C) 2001 Clemson University and The University of Chicago - * - * See COPYING in top-level directory. - */ - -/** \defgroup codeslogging codeslogging logging interface - * - * This is a basic application logging facility. It uses printf style - * formatting and provides several mechanisms for output. - * - * @{ - */ - -/* This code was derived from the PVFS2 codeslogging circa vs. 2.8.1 */ - -/** \file - * - * Declarations for the codeslogging logging interface. - */ - -#ifndef SRC_COMMON_LOGGING_CODESLOGGING_H -#define SRC_COMMON_LOGGING_CODESLOGGING_H - -#include -#include - -/******************************************************************** - * Visible interface - */ - -#define CODESLOGGING_BUF_SIZE 1024 - -/* what type of timestamp to place in msgs */ -enum codeslogging_logstamp -{ - CODESLOGGING_LOGSTAMP_NONE = 0, - CODESLOGGING_LOGSTAMP_USEC = 1, - CODESLOGGING_LOGSTAMP_DATETIME = 2, - CODESLOGGING_LOGSTAMP_THREAD = 3 -}; -#define CODESLOGGING_LOGSTAMP_DEFAULT CODESLOGGING_LOGSTAMP_USEC - -/* stdio is needed by codeslogging_debug_fp declaration for FILE* */ -#include - -int codeslogging_enable_stderr( - void); -int codeslogging_enable_file( - const char *filename, - const char *mode); -int codeslogging_disable( - void); -int codeslogging_set_debug_mask( - int debug_on, - uint64_t mask); -int codeslogging_get_debug_mask( - int *debug_on, - uint64_t * mask); -int codeslogging_set_logstamp( - enum codeslogging_logstamp ts); - -void codeslogging_backtrace( - void); - -#ifdef __GNUC__ - -/* do printf style type checking if built with gcc */ -int __codeslogging_debug( - uint64_t mask, - char prefix, - const char *format, - ...) __attribute__ ((format(printf, 3, 4))); -int codeslogging_err( - const char *format, - ...) __attribute__ ((format(printf, 1, 2))); -int __codeslogging_debug_va( - uint64_t mask, - char prefix, - const char *format, - va_list ap); -int codeslogging_debug_fp( - FILE * fp, - char prefix, - enum codeslogging_logstamp ts, - const char *format, - ...) __attribute__ ((format(printf, 4, 5))); - -#ifdef CODESLOGGING_DISABLE_DEBUG -#define codeslogging_debug(mask, format, f...) do {} while(0) -#define codeslogging_perf_log(format, f...) do {} while(0) -#define codeslogging_debug_enabled(__m) 0 -#else -extern int codeslogging_debug_on; -extern int codeslogging_facility; -extern uint64_t codeslogging_debug_mask; - -#define codeslogging_debug_enabled(__m) \ - (codeslogging_debug_on && (codeslogging_debug_mask & __m)) - -/* try to avoid function call overhead by checking masks in macro */ -#define codeslogging_debug(mask, format, f...) \ -do { \ - if ((codeslogging_debug_on) && (codeslogging_debug_mask & mask) &&\ - (codeslogging_facility)) \ - { \ - __codeslogging_debug(mask, '?', format, ##f); \ - } \ -} while(0) -#define codeslogging_perf_log(format, f...) \ -do { \ - if ((codeslogging_debug_on) && \ - (codeslogging_debug_mask & CODESLOGGING_PERFCOUNTER_DEBUG) && \ - (codeslogging_facility)) \ - { \ - __codeslogging_debug(CODESLOGGING_PERFCOUNTER_DEBUG, 'P', \ - format, ##f); \ - } \ -} while(0) - -#endif /* CODESLOGGING_DISABLE_DEBUG */ - -/* do file and line number printouts w/ the GNU preprocessor */ -#define codeslogging_ldebug(mask, format, f...) \ -do { \ - codeslogging_debug(mask, "%s: " format, __func__ , ##f); \ -} while(0) - -#define codeslogging_lerr(format, f...) \ -do { \ - codeslogging_err("%s line %d: " format, __FILE__ , __LINE__ , ##f); \ - codeslogging_backtrace(); \ -} while(0) -#else /* ! __GNUC__ */ - -int __codeslogging_debug( - uint64_t mask, - char prefix, - const char *format, - ...); -int __codeslogging_debug_stub( - uint64_t mask, - char prefix, - const char *format, - ...); -int codeslogging_err( - const char *format, - ...); - -#ifdef CODESLOGGING_DISABLE_DEBUG -#define codeslogging_debug(__m, __f, f...) __codeslogging_debug_stub(__m, '?', __f, ##f); -#define codeslogging_ldebug(__m, __f, f...) __codeslogging_debug_stub(__m, '?', __f, ##f); -#define codeslogging_debug_enabled(__m) 0 -#else -#define codeslogging_debug(__m, __f, f...) __codeslogging_debug(__m, '?', __f, ##f); -#define codeslogging_ldebug(__m, __f, f...) __codeslogging_debug(__m, '?', __f, ##f); -#define codeslogging_debug_enabled(__m) \ - ((codeslogging_debug_on != 0) && (__m & codeslogging_debug_mask)) - -#endif /* CODESLOGGING_DISABLE_DEBUG */ - -#define codeslogging_lerr codeslogging_err - -#endif /* __GNUC__ */ - -#endif /* __CODESLOGGING_H */ - -/* @} */ - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - * - * vim: ts=8 sts=4 sw=4 expandtab - */ diff --git a/codes/timeline.h b/codes/timeline.h deleted file mode 100644 index fd65c6529514bc1a4ee777f8b92f3a86a5c6c94c..0000000000000000000000000000000000000000 --- a/codes/timeline.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2013 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - */ - -/* - * timeline.h - * - * Created on: Jun 24, 2013 - * Author: wozniak - */ - -#ifndef TIMELINE_H -#define TIMELINE_H - -#define TIMELINE_ENABLED 0 - -#if TIMELINE_ENABLED == 1 - -#include - -/** - Open filename for writing for timeline data - @return 1 on success, 0 on error - */ -int timeline_init(const char *filename); - -/** - Write a timeline record - @return 1 on success, 0 on error - */ -int timeline_printf(const char *format, ...); - -/** - Write a timeline record - @return 1 on success, 0 on error - */ -int timeline_printf_va(const char *format, va_list ap); - -/** - Write a timeline record with typical ROSS metadata - @return 1 on success, 0 on error - */ -#define timeline_event(lp, format, args...) \ - timeline_event_impl(lp, __func__, format, ##args) - -int timeline_event_impl(const tw_lp *lp, const char *func, - const char *format, ...); - -/** - Finalize the timeline module - */ -void timeline_finalize(void); - -#else - -// Set all functions to noops (return success value 1) -#define timeline_init(x) 1 -#define timeline_printf(f, a...) 1 -#define timeline_printf_va(f, a) 1 -#define timeline_event(lp, f, a...) 1 -#define timeline_finalize() - -#endif - -#endif - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - * - * vim: ts=8 sts=4 sw=4 expandtab - */ diff --git a/src/Makefile.subdir b/src/Makefile.subdir index 3093d3b68e0175a2e6ef77475752d4c9afd82f64..46b3b411abc368be8e665ba9d97af5d2b9029f5a 100644 --- a/src/Makefile.subdir +++ b/src/Makefile.subdir @@ -50,8 +50,6 @@ nobase_include_HEADERS = \ codes/CodesIOKernelTypes.h \ codes/codeslexer.h \ codes/txt_configfile.h \ - codes/codeslogging.h \ - codes/timeline.h \ codes/codesparser.h \ codes/quickhash.h \ codes/configfile.h \ @@ -105,10 +103,6 @@ src_libcodes_base_a_SOURCES = \ src/util/resource.c \ src/util/resource-lp.c \ src/util/local-storage-model.c \ - codes/codeslogging.h \ - src/logging/codeslogging.c \ - codes/timeline.h \ - src/logging/timeline.c \ src/workload/codes-workload.c \ src/workload/codes-workload-method.h \ src/workload/methods/codes-bgp-io-wrkld.c \ diff --git a/src/logging/codeslogging.c b/src/logging/codeslogging.c deleted file mode 100644 index b7c2ac19705170fbf18db990b6d0b8e6d6215854..0000000000000000000000000000000000000000 --- a/src/logging/codeslogging.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright (C) 2013 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - */ - -/* - * (C) 2001 Clemson University and The University of Chicago - * - * See COPYING in top-level directory. - */ - -/** \file - * \ingroup codeslogging - * - * Implementation of codeslogging interface. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_EXECINFO_H -#include -#endif - -#include "codes/codeslogging.h" -#include - -/** controls whether debugging is on or off */ -int codeslogging_debug_on = 0; - -/** controls the mask level for debugging messages */ -uint64_t codeslogging_debug_mask = 0; - -enum -{ - CODESLOGGING_STDERR = 1, - CODESLOGGING_FILE = 2, -}; - -/** determines which logging facility to use. Default to stderr to begin - * with. - */ -int codeslogging_facility = CODESLOGGING_STDERR; - -/* file handle used for file logging */ -static FILE *internal_log_file = NULL; - -/* what type of timestamp to put on logs */ -static enum codeslogging_logstamp internal_logstamp = CODESLOGGING_LOGSTAMP_DEFAULT; - -/***************************************************************** - * prototypes - */ -static int codeslogging_disable_stderr( - void); -static int codeslogging_disable_file( - void); - -static int codeslogging_debug_fp_va( - FILE * fp, - char prefix, - const char *format, - va_list ap, - enum codeslogging_logstamp ts); - -/***************************************************************** - * visible functions - */ - -/** Turns on logging to stderr. - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_enable_stderr( - void) -{ - - /* keep up with the existing logging settings */ - int tmp_debug_on = codeslogging_debug_on; - uint64_t tmp_debug_mask = codeslogging_debug_mask; - - /* turn off any running facility */ - codeslogging_disable(); - - codeslogging_facility = CODESLOGGING_STDERR; - - /* restore the logging settings */ - codeslogging_debug_on = tmp_debug_on; - codeslogging_debug_mask = tmp_debug_mask; - - return 0; -} - -/** Turns on logging to a file. The filename argument indicates which - * file to use for logging messages, and the mode indicates whether the - * file should be truncated or appended (see fopen() man page). - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_enable_file( - const char *filename, - const char *mode) -{ - - /* keep up with the existing logging settings */ - int tmp_debug_on = codeslogging_debug_on; - uint64_t tmp_debug_mask = codeslogging_debug_mask; - - /* turn off any running facility */ - codeslogging_disable(); - - internal_log_file = fopen(filename, mode); - if(!internal_log_file) - { - return -errno; - } - - codeslogging_facility = CODESLOGGING_FILE; - - /* restore the logging settings */ - codeslogging_debug_on = tmp_debug_on; - codeslogging_debug_mask = tmp_debug_mask; - - return 0; -} - -/** Turns off any active logging facility and disables debugging. - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_disable( - void) -{ - int ret = -EINVAL; - - switch (codeslogging_facility) - { - case CODESLOGGING_STDERR: - ret = codeslogging_disable_stderr(); - break; - case CODESLOGGING_FILE: - ret = codeslogging_disable_file(); - break; - default: - break; - } - - codeslogging_debug_on = 0; - codeslogging_debug_mask = 0; - - return ret; -} - -/** Fills in args indicating whether debugging is on or off, and what the - * mask level is. - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_get_debug_mask( - int *debug_on, - uint64_t * mask) -{ - *debug_on = codeslogging_debug_on; - *mask = codeslogging_debug_mask; - return 0; -} - -/** Determines whether debugging messages are turned on or off. Also - * specifies the mask that determines which debugging messages are - * printed. - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_set_debug_mask( - int debug_on, - uint64_t mask) -{ - if((debug_on != 0) && (debug_on != 1)) - { - return -EINVAL; - } - - codeslogging_debug_on = debug_on; - codeslogging_debug_mask = mask; - return 0; -} - -/* codeslogging_set_logstamp() - * - * sets timestamp style for codeslogging messages - * - * returns 0 on success, -errno on failure - */ -int codeslogging_set_logstamp( - enum codeslogging_logstamp ts) -{ - internal_logstamp = ts; - return (0); -} - -#ifndef __GNUC__ -/* __codeslogging_debug_stub() - * - * stub for codeslogging_debug that doesn't do anything; used when debugging - * is "compiled out" on non-gcc builds - * - * returns 0 - */ -int __codeslogging_debug_stub( - uint64_t mask, - char prefix, - const char *format, - ...) -{ - return 0; -} -#endif - -/* __codeslogging_debug() - * - * Logs a standard debugging message. It will not be printed unless the - * mask value matches (logical "and" operation) with the mask specified in - * codeslogging_set_debug_mask() and debugging is turned on. - * - * returns 0 on success, -errno on failure - */ -int __codeslogging_debug( - uint64_t mask, - char prefix, - const char *format, - ...) -{ - int ret = -EINVAL; - va_list ap; - - /* rip out the variable arguments */ - va_start(ap, format); - ret = __codeslogging_debug_va(mask, prefix, format, ap); - va_end(ap); - - return ret; -} - -int __codeslogging_debug_va( - uint64_t mask, - char prefix, - const char *format, - va_list ap) -{ - int ret = -EINVAL; - - /* NOTE: this check happens in the macro (before making a function call) - * if we use gcc - */ -#ifndef __GNUC__ - /* exit quietly if we aren't meant to print */ - if((!codeslogging_debug_on) || !(codeslogging_debug_mask & mask) || (!codeslogging_facility)) - { - return 0; - } -#endif - - if(prefix == '?') - { - /* automatic prefix assignment */ - prefix = 'D'; - } - - switch (codeslogging_facility) - { - case CODESLOGGING_STDERR: - ret = codeslogging_debug_fp_va(stderr, prefix, format, ap, internal_logstamp); - break; - case CODESLOGGING_FILE: - ret = - codeslogging_debug_fp_va(internal_log_file, prefix, format, ap, internal_logstamp); - break; - default: - break; - } - - return ret; -} - -/** Logs a critical error message. This will print regardless of the - * mask value and whether debugging is turned on or off, as long as some - * logging facility has been enabled. - * - * \return 0 on success, -errno on failure. - */ -int codeslogging_err( - const char *format, - ...) -{ - va_list ap; - int ret = -EINVAL; - - if(!codeslogging_facility) - { - return 0; - } - - /* rip out the variable arguments */ - va_start(ap, format); - - switch (codeslogging_facility) - { - case CODESLOGGING_STDERR: - ret = codeslogging_debug_fp_va(stderr, 'E', format, ap, internal_logstamp); - break; - case CODESLOGGING_FILE: - ret = codeslogging_debug_fp_va(internal_log_file, 'E', format, ap, internal_logstamp); - break; - default: - break; - } - - va_end(ap); - - return ret; -} - -#ifdef CODESLOGGING_ENABLE_BACKTRACE -#ifndef CODESLOGGING_BACKTRACE_DEPTH -#define CODESLOGGING_BACKTRACE_DEPTH 12 -#endif -/** Prints out a dump of the current stack (excluding this function) - * using codeslogging_err. - */ -void codeslogging_backtrace( - void) -{ - void *trace[CODESLOGGING_BACKTRACE_DEPTH]; - char **messages = NULL; - int i, trace_size; - - trace_size = backtrace(trace, CODESLOGGING_BACKTRACE_DEPTH); - messages = backtrace_symbols(trace, trace_size); - for(i = 1; i < trace_size; i++) - { - codeslogging_err("\t[bt] %s\n", messages[i]); - } - free(messages); -} -#else -void codeslogging_backtrace( - void) -{ -} -#endif - -/**************************************************************** - * Internal functions - */ - -int codeslogging_debug_fp( - FILE * fp, - char prefix, - enum codeslogging_logstamp ts, - const char *format, - ...) -{ - int ret; - va_list ap; - - /* rip out the variable arguments */ - va_start(ap, format); - ret = codeslogging_debug_fp_va(fp, prefix, format, ap, ts); - va_end(ap); - return ret; -} - -/* codeslogging_debug_fp_va() - * - * This is the standard debugging message function for the file logging - * facility or to stderr. - * - * returns 0 on success, -errno on failure - */ -static int codeslogging_debug_fp_va( - FILE * fp, - char prefix, - const char *format, - va_list ap, - enum codeslogging_logstamp ts) -{ - char buffer[CODESLOGGING_BUF_SIZE], *bptr = buffer; - int bsize = sizeof(buffer); - int ret = -EINVAL; - struct timeval tv; - time_t tp; - - sprintf(bptr, "[%c ", prefix); - bptr += 3; - bsize -= 3; - - switch (ts) - { - case CODESLOGGING_LOGSTAMP_USEC: - gettimeofday(&tv, 0); - tp = tv.tv_sec; - strftime(bptr, 9, "%H:%M:%S", localtime(&tp)); - sprintf(bptr + 8, ".%06ld] ", (long) tv.tv_usec); - bptr += 17; - bsize -= 17; - break; - case CODESLOGGING_LOGSTAMP_DATETIME: - gettimeofday(&tv, 0); - tp = tv.tv_sec; - strftime(bptr, 22, "%m/%d/%Y %H:%M:%S] ", localtime(&tp)); - bptr += 21; - bsize -= 21; - break; - case CODESLOGGING_LOGSTAMP_THREAD: - gettimeofday(&tv, 0); - tp = tv.tv_sec; - strftime(bptr, 9, "%H:%M:%S", localtime(&tp)); - sprintf(bptr + 8, ".%06ld (%ld)] ", (long) tv.tv_usec, pthread_self()); - bptr += 30; - bsize -= 30; - break; - - case CODESLOGGING_LOGSTAMP_NONE: - bptr--; - sprintf(bptr, "] "); - bptr += 2; - bsize++; - break; - default: - break; - } - - ret = vsnprintf(bptr, bsize, format, ap); - if(ret < 0) - { - return -errno; - } - - ret = fprintf(fp, "%s", buffer); - if(ret < 0) - { - return -errno; - } - fflush(fp); - - return 0; -} - -/* codeslogging_disable_stderr() - * - * The shutdown function for the stderr logging facility. - * - * returns 0 on success, -errno on failure - */ -static int codeslogging_disable_stderr( - void) -{ - /* this function doesn't need to do anything... */ - return 0; -} - -/* codeslogging_disable_file() - * - * The shutdown function for the file logging facility. - * - * returns 0 on success, -errno on failure - */ -static int codeslogging_disable_file( - void) -{ - if(internal_log_file) - { - fclose(internal_log_file); - internal_log_file = NULL; - } - return 0; -} - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - * - * vim: ts=8 sts=4 sw=4 expandtab - */ diff --git a/src/logging/timeline.c b/src/logging/timeline.c deleted file mode 100644 index b7dfa92876cb6a285fe3995c27f0c6cac2958ad6..0000000000000000000000000000000000000000 --- a/src/logging/timeline.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2013 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - */ - -/* - * timeline.c - * - * Created on: Jun 24, 2013 - * Author: wozniak - */ - -#include -#include -#include -#include -#include - -#include "codes/timeline.h" - -// If timeline is not enabled, all functions are defined to noops -#if TIMELINE_ENABLED == 1 - -static char* name = NULL; -static FILE* fp = NULL; - -int timeline_init(const char *filename) -{ - name = strdup(filename); - fp = fopen(filename, "w"); - if (fp == NULL) - { - perror(__func__); - return 0; - } - return 1; -} - -int timeline_printf(const char *format, ...) -{ - int rc; - va_list ap; - - va_start(ap, format); - rc = timeline_printf_va(format, ap); - va_end(ap); - - return rc; -} - -int timeline_printf_va(const char *format, va_list ap) -{ - int rc; - if (fp == NULL) - { - printf("timeline module is not initialized!\n"); - exit(1); - } - rc = vfprintf(fp, format, ap); - if (rc < 0) return 0; - return 1; -} - -int timeline_event_impl(const tw_lp *lp, const char *func, - const char *format, ...) -{ - int rc; - va_list ap; - rc = timeline_printf("%4i %016.6f %-24s", - lp->gid, lp->kp->last_time, func); - if (rc == 0) return 0; - va_start(ap, format); - rc = timeline_printf_va(format, ap); - if (rc == 0) return 0; - va_end(ap); - return 1; -} - -void timeline_finalize() -{ - assert(fp != NULL); - fclose(fp); - printf("wrote timeline to: %s\n", name); - free(name); -} - -#endif - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - * - * vim: ts=8 sts=4 sw=4 expandtab - */ diff --git a/src/util/local-storage-model.c b/src/util/local-storage-model.c index cd0ea5ccc76a8a72f6282ac34c1a7d5e9407febf..e23bbd9a83311670266776417786db89d2c859fc 100644 --- a/src/util/local-storage-model.c +++ b/src/util/local-storage-model.c @@ -6,7 +6,6 @@ #include #include -#include "codes/timeline.h" #include "codes/lp-io.h" #include "codes/jenkins-hash.h" #include "codes/codes.h" @@ -543,12 +542,6 @@ static void handle_io_request(lsm_state_t *ns, transfer_time = transfer_time_table; - if (TIMELINE_ENABLED) - { - __attribute__((unused)) char rwc = (rw) ? 'R' : 'W'; - (void) timeline_event(lp, "%c %llu %llu\n", rwc, m_in->u.data.offset, m_in->u.data.size); - } - stat = find_stats(m_in->u.data.category, ns); /* save history for reverse operation */ diff --git a/tests/local-storage-model-test.c b/tests/local-storage-model-test.c index 0b1a5cfc3404f9ee2a48585d2bfb2acf48b1f202..b4f8e468b8f698d81428330c96742cee3f04aec1 100644 --- a/tests/local-storage-model-test.c +++ b/tests/local-storage-model-test.c @@ -12,7 +12,6 @@ #include #include -#include "codes/timeline.h" #include "codes/lp-io.h" #include "codes/codes.h" #include "codes/codes_mapping.h" @@ -139,12 +138,6 @@ int main( tw_opt_add(app_opt); tw_init(&argc, &argv); - ret = timeline_init("timeline.data"); - if (ret != 1) - { - return(-1); - } - MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); @@ -174,7 +167,6 @@ int main( ret = lp_io_flush(handle, MPI_COMM_WORLD); assert(ret == 0); - timeline_finalize(); tw_end(); return 0; @@ -303,8 +295,6 @@ static void handle_kickoff_event( double rate; double seek; - (void) timeline_event(lp, "\n"); - if (LSM_DEBUG) printf("handle_kickoff_event(), lp %llu.\n", (unsigned long long)lp->gid);