timeline.h 1.4 KB
Newer Older
1
/*
Philip Carns's avatar
Philip Carns committed
2
 * Copyright (C) 2013 University of Chicago.
3
 * See COPYRIGHT notice in top-level directory.
Philip Carns's avatar
Philip Carns committed
4
 *
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
 */

/*
 * 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
Philip Carns's avatar
Philip Carns committed
68 69 70 71 72 73 74 75 76

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