MCPcopy Create free account
hub / github.com/PaperMC/Paper / TimingHistory

Class TimingHistory

paper-api/src/main/java/co/aikar/timings/TimingHistory.java:57–356  ·  view source on GitHub ↗

@hidden @deprecated Timings will be removed in the future

Source from the content-addressed store, hash-verified

55 * @deprecated Timings will be removed in the future
56 */
57@Deprecated(forRemoval = true)
58@SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"})
59public class TimingHistory {
60 public static long lastMinuteTime;
61 public static long timedTicks;
62 public static long playerTicks;
63 public static long entityTicks;
64 public static long tileEntityTicks;
65 public static long activatedEntityTicks;
66 private static int worldIdPool = 1;
67 static Map<String, Integer> worldMap = LoadingMap.newHashMap(new Function<String, Integer>() {
68 @NotNull
69 @Override
70 public Integer apply(@Nullable String input) {
71 return worldIdPool++;
72 }
73 });
74 private final long endTime;
75 private final long startTime;
76 private final long totalTicks;
77 private final long totalTime; // Represents all time spent running the server this history
78 private final MinuteReport[] minuteReports;
79
80 private final TimingHistoryEntry[] entries;
81 final Set<Material> tileEntityTypeSet = Sets.newHashSet();
82 final Set<EntityType> entityTypeSet = Sets.newHashSet();
83 private final Map<Object, Object> worlds;
84
85 TimingHistory() {
86 this.endTime = System.currentTimeMillis() / 1000;
87 this.startTime = TimingsManager.historyStart / 1000;
88 if (timedTicks % 1200 != 0 || MINUTE_REPORTS.isEmpty()) {
89 this.minuteReports = MINUTE_REPORTS.toArray(new MinuteReport[MINUTE_REPORTS.size() + 1]);
90 this.minuteReports[this.minuteReports.length - 1] = new MinuteReport();
91 } else {
92 this.minuteReports = MINUTE_REPORTS.toArray(new MinuteReport[MINUTE_REPORTS.size()]);
93 }
94 long ticks = 0;
95 for (MinuteReport mp : this.minuteReports) {
96 ticks += mp.ticksRecord.timed;
97 }
98 this.totalTicks = ticks;
99 this.totalTime = FULL_SERVER_TICK.record.getTotalTime();
100 this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()];
101
102 int i = 0;
103 for (TimingHandler handler : TimingsManager.HANDLERS) {
104 entries[i++] = new TimingHistoryEntry(handler);
105 }
106
107 // Information about all loaded chunks/entities
108 //noinspection unchecked
109 this.worlds = toObjectMapper(Bukkit.getWorlds(), new Function<World, JSONPair>() {
110 @NotNull
111 @Override
112 public JSONPair apply(World world) {
113 Map<RegionId, RegionData> regions = LoadingMap.newHashMap(RegionData.LOADER);
114

Callers

nothing calls this directly

Calls 1

newHashMapMethod · 0.95

Tested by

no test coverage detected