24 */ |
24 */ |
25 |
25 |
26 package jdk.jfr.consumer; |
26 package jdk.jfr.consumer; |
27 |
27 |
28 import java.time.Duration; |
28 import java.time.Duration; |
29 import java.time.Instant; |
|
30 import java.util.Arrays; |
29 import java.util.Arrays; |
31 import java.util.List; |
30 import java.util.List; |
32 |
31 |
33 final class EventFilter { |
32 final class EventFilter { |
34 private final String[] eventNames; |
33 private final String[] eventNames; |
43 |
42 |
44 public static EventFilter eventTypes(String... eventNames) { |
43 public static EventFilter eventTypes(String... eventNames) { |
45 return new EventFilter(eventNames.clone(), null, new String[0]); |
44 return new EventFilter(eventNames.clone(), null, new String[0]); |
46 } |
45 } |
47 |
46 |
48 public EventFilter threshold(Duration threshold) { |
47 public EventFilter aboveThreshold(Duration threshold) { |
49 return new EventFilter(eventNames, threshold, fields); |
48 return new EventFilter(eventNames, threshold, fields); |
50 } |
49 } |
51 |
50 |
52 public EventFilter fields(String... fieldNames) { |
51 public EventFilter mustHaveFields(String... fieldNames) { |
53 return new EventFilter(eventNames, threshold, fieldNames); |
52 return new EventFilter(eventNames, threshold, fieldNames); |
54 } |
53 } |
55 |
54 |
56 public EventFilter start(Instant instant) { |
55 |
|
56 |
|
57 public EventFilter onlyThreads(Thread... t) { |
57 return this; |
58 return this; |
58 } |
59 } |
59 |
60 |
60 public EventFilter end(Instant instant) { |
61 public EventFilter onlyThreadIds(long... threadId) { |
61 return this; |
62 return this; |
62 } |
63 } |
63 |
64 |
64 public EventFilter threads(Thread... t) { |
65 public EventFilter onlyThreadNames(String... threadName) { |
65 return this; |
|
66 } |
|
67 |
|
68 public EventFilter threadIds(long... threadId) { |
|
69 return this; |
|
70 } |
|
71 |
|
72 public EventFilter threadNames(String... threadName) { |
|
73 return this; |
66 return this; |
74 } |
67 } |
75 |
68 |
76 public EventFilter threadFilters(String... filter) { |
69 public EventFilter threadFilters(String... filter) { |
77 return this; |
70 return this; |