-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathProfilerImpl.java
More file actions
37 lines (28 loc) · 855 Bytes
/
ProfilerImpl.java
File metadata and controls
37 lines (28 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package graphql;
import graphql.schema.DataFetcher;
import graphql.schema.PropertyDataFetcher;
import org.jspecify.annotations.NullMarked;
import java.util.concurrent.atomic.AtomicInteger;
@Internal
@NullMarked
public class ProfilerImpl implements Profiler {
volatile long startTime;
volatile int rootFieldCount;
AtomicInteger fieldCount;
AtomicInteger propertyDataFetcherCount;
@Override
public void start() {
startTime = System.nanoTime();
}
@Override
public void rootFieldCount(int count) {
this.rootFieldCount = count;
}
@Override
public void fieldFetched(Object fetchedObject, DataFetcher<?> dataFetcher) {
fieldCount.incrementAndGet();
if (dataFetcher instanceof PropertyDataFetcher) {
propertyDataFetcherCount.incrementAndGet();
}
}
}