]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/EventTrace.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2016 Intel Corporation.
9 * Author: Anjaneya Chagam <anjaneya.chagam@intel.com>
11 * This is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License version 2.1, as published by the Free Software
14 * Foundation. See file COPYING.
18 #ifndef _EventTrace_h_
19 #define _EventTrace_h_
21 #include "msg/Message.h"
23 #if defined(WITH_EVENTTRACE)
25 #define OID_EVENT_TRACE(oid, event) \
26 EventTrace::trace_oid_event(oid, event, "", __FILE__, __func__, __LINE__)
27 #define OID_EVENT_TRACE_WITH_MSG(msg, event, incl_oid) \
28 EventTrace::trace_oid_event(msg, event, __FILE__, __func__, __LINE__, incl_oid)
29 #define OID_ELAPSED(oid, elapsed, event) \
30 EventTrace::trace_oid_elapsed(oid, event, "", elapsed, __FILE__, __func__, __LINE__)
31 #define OID_ELAPSED_WITH_MSG(m, elapsed, event, incl_oid) \
32 EventTrace::trace_oid_elapsed(m, event, elapsed, __FILE__, __func__, __LINE__, incl_oid)
33 #define FUNCTRACE(cct) EventTrace _t1(cct, __FILE__, __func__, __LINE__)
34 #define OID_ELAPSED_FUNC_EVENT(event) _t1.log_event_latency(event)
38 #define OID_EVENT_TRACE(oid, event)
39 #define OID_EVENT_TRACE_WITH_MSG(msg, event, incl_oid)
40 #define OID_ELAPSED(oid, elapsed, event)
41 #define OID_ELAPSED_WITH_MSG(m, elapsed, event, incl_oid)
42 #define FUNCTRACE(cct)
43 #define OID_ELAPSED_FUNC_EVENT(event)
59 static void init_tp(CephContext
*_ctx
);
60 static void set_message_attrs(const Message
*m
, std::string
& oid
, std::string
& context
, bool incl_oid
);
64 EventTrace(CephContext
*_ctx
, const char *_file
, const char *_func
, int line
);
66 void log_event_latency(const char *tag
);
68 static void trace_oid_event(const char *oid
, const char *event
, const char *context
,
69 const char *file
, const char *func
, int line
);
70 static void trace_oid_event(const Message
*m
, const char *event
, const char *file
,
71 const char *func
, int line
, bool incl_oid
);
73 static void trace_oid_elapsed(const char *oid
, const char *event
, const char *context
,
74 double elapsed
, const char *file
, const char *func
, int line
);
75 static void trace_oid_elapsed(const Message
*m
, const char *event
, double elapsed
,
76 const char *file
, const char *func
, int line
, bool incl_oid
);