1 /*********************************************************************
3 * Copyright 2012 Intel Corporation
4 * Copyright 2012 VMware, Inc.
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy,
11 * modify, merge, publish, distribute, sublicense, and/or sell copies
12 * of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 *********************************************************************/
29 #ifndef _TRACE_FAST_CALLSET_HPP_
30 #define _TRACE_FAST_CALLSET_HPP_
32 #include "trace_model.hpp"
36 /* A set of call numbers.
38 * This was originally designed as a more efficient replacement for
39 * std::set<unsigned> which was used heavily within the trim code's
40 * TraceAnalyzer. This is quite similar to the trace::CallSet with the
41 * following differences:
45 * * There is no support here for the 'step' and 'freq' features
46 * supported by trace::CallSet.
50 * * This callset is implemented with a skip list for
51 * (probabilistically) logarithmic lookup times for
52 * out-of-order lookups.
54 * * This callset optimizes the addition of new calls which are
55 * within or adjacent to existing ranges, (by either doing
56 * nothing, expanding the limits of an existing range, or also
57 * merging two or more ranges).
59 * It would not be impossible to extend this code to support the
60 * missing features of trace::CallSet, (though the 'step' and 'freq'
61 * features would prevent some range-extending and merging
62 * optimizations in some cases).
72 FastCallRange(CallNo first, CallNo last, int level);
74 bool contains(CallNo call_no) const;
84 bool empty(void) const;
86 void add(CallNo first, CallNo last);
88 void add(CallNo call_no);
90 bool contains(CallNo call_no) const;
93 } /* namespace trace */
95 #endif /* _TRACE_FAST_CALLSET_HPP_ */