- * Does a given stream contain any events?
- * @param id the stream ID
- * @return true if the stream has events.
+ * Adds a callsite
+ *
+ * @param eventName
+ * the event name of the callsite
+ * @param funcName
+ * the name of the callsite function
+ * @param ip
+ * the ip of the callsite
+ * @param fileName
+ * the filename of the callsite
+ * @param lineNumber
+ * the line number of the callsite
+ */
+ public void addCallsite(String eventName, String funcName, long ip,
+ String fileName, long lineNumber) {
+ final CTFCallsite cs = new CTFCallsite(eventName, funcName, ip,
+ fileName, lineNumber);
+ TreeSet<CTFCallsite> csl = fCallsitesByName.get(eventName);
+ if (csl == null) {
+ csl = new TreeSet<>(fCtfCallsiteComparator);
+ fCallsitesByName.put(eventName, csl);
+ }
+
+ csl.add(cs);
+
+ fCallsitesByIP.add(cs);
+ }
+
+ /**
+ * Gets the set of callsites associated to an event name. O(1)
+ *
+ * @param eventName
+ * the event name
+ * @return the callsite set can be empty
+ * @since 3.0