SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
Loading...
Searching...
No Matches
trace_monitor.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2016 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_SYSTEMC_TRACE_MONITOR_H
17#define SIMICS_SYSTEMC_TRACE_MONITOR_H
18
19#include <systemc>
21
22#include <set>
23#include <map>
24#include <utility>
25
26namespace simics {
27namespace systemc {
28
29class EventCallbackAdapter;
30class EventCallbackInterface;
31
34 public:
36 TraceMonitor(const TraceMonitor&) = delete;
38 virtual ~TraceMonitor();
39 virtual void subscribeAllDynamic(const char *event_type,
40 EventCallbackInterface *callback);
41 virtual void subscribe(const char *event_type, const void *obj,
42 EventCallbackInterface *callback,
43 bool trace);
44 virtual void unsubscribeAllDynamic(const char *event_type,
45 EventCallbackInterface *callback);
46 virtual void kernel_callback(int kernel_event_type,
47 const char *event_type,
48 const char *event_class_type,
49 void *event_object,
50 const sc_core::sc_time &ts);
51
52 private:
53 typedef std::pair<EventCallbackInterface *, bool> entry;
54
55 void add_callback(int event_id, EventCallbackInterface *callback);
56 void remove_callback(int event_id, EventCallbackInterface *callback);
57
58 // Mapping between event/process object and proxy callback (not dynamic).
59 // This map is also used to filter objects for the dynamic callbacks.
60 // If the object is part of this map, no dynamic callback is invoked.
61 std::map<const void *, entry> trace_callbacks_;
62 // Mapping between kernel event ID and dynamic events/processes callbacks.
63 // These callbacks are invoked for dynamically created events and process
64 // that do not have a proxy object.
65 std::map<int, EventCallbackInterface *> trace_dynamic_callbacks_;
66 // This map contains entries for enabled callbacks (trace=true) and
67 // dynamic callbacks. If the map does not contain an entry for an kernel
68 // event ID, no tool is connected and the event can just be ignored.
69 std::multimap<int, EventCallbackInterface *> trace_all_callbacks_;
70 // Set to do early return in the kernel event callback (optimization to
71 // avoid count on multimap).
72 std::set<int> is_event_traced_;
73 EventCallbackAdapter *adapter_;
74};
75
76} // namespace systemc
77} // namespace simics
78
79#endif
Definition: trace_monitor_interface.h:30
Definition: trace_monitor_interface.h:40
Definition: trace_monitor.h:33
TraceMonitor(const TraceMonitor &)=delete
TraceMonitor & operator=(const TraceMonitor &)=delete
virtual void unsubscribeAllDynamic(const char *event_type, EventCallbackInterface *callback)
virtual void subscribe(const char *event_type, const void *obj, EventCallbackInterface *callback, bool trace)
virtual void subscribeAllDynamic(const char *event_type, EventCallbackInterface *callback)
virtual void kernel_callback(int kernel_event_type, const char *event_type, const char *event_class_type, void *event_object, const sc_core::sc_time &ts)
Definition: pci_bus_interface.h:24