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