Commit 4928a7b8 authored by Jonathan Jenkins's avatar Jonathan Jenkins

bye-bye logging, timeline stuff

parent 9b95fe57
/*
* 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 <stdint.h>
#include <stdarg.h>
/********************************************************************
* 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 <stdio.h>
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
*/
/*
* 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 <ross.h>
/**
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
*/
......@@ -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 \
......
This diff is collapsed.
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
/*
* timeline.c
*
* Created on: Jun 24, 2013
* Author: wozniak
*/
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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
*/
......@@ -6,7 +6,6 @@
#include <assert.h>
#include <ross.h>
#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 */
......
......@@ -12,7 +12,6 @@
#include <assert.h>
#include <ross.h>
#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);
......
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