MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / Profiler

Class Profiler

src/main/java/net/minecraft/profiler/Profiler.java:14–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12import org.apache.logging.log4j.Logger;
13
14public class Profiler
15{
16 private static final Logger logger = LogManager.getLogger();
17 private final List<String> sectionList = Lists.<String>newArrayList();
18 private final List<Long> timestampList = Lists.<Long>newArrayList();
19
20 /** Flag profiling enabled */
21 public boolean profilingEnabled;
22
23 /** Current profiling section */
24 private String profilingSection = "";
25 private final Map<String, Long> profilingMap = Maps.<String, Long>newHashMap();
26 public boolean profilerGlobalEnabled = true;
27 private boolean profilerLocalEnabled;
28 private static final String SCHEDULED_EXECUTABLES = "scheduledExecutables";
29 private static final String TICK = "tick";
30 private static final String PRE_RENDER_ERRORS = "preRenderErrors";
31 private static final String RENDER = "render";
32 private static final String DISPLAY = "display";
33 private static final int HASH_SCHEDULED_EXECUTABLES = "scheduledExecutables".hashCode();
34 private static final int HASH_TICK = "tick".hashCode();
35 private static final int HASH_PRE_RENDER_ERRORS = "preRenderErrors".hashCode();
36 private static final int HASH_RENDER = "render".hashCode();
37 private static final int HASH_DISPLAY = "display".hashCode();
38
39 public Profiler()
40 {
41 this.profilerLocalEnabled = this.profilerGlobalEnabled;
42 }
43
44 /**
45 * Clear profiling.
46 */
47 public void clearProfiling()
48 {
49 this.profilingMap.clear();
50 this.profilingSection = "";
51 this.sectionList.clear();
52 this.profilerLocalEnabled = this.profilerGlobalEnabled;
53 }
54
55 /**
56 * Start section
57 */
58 public void startSection(String name)
59 {
60 if (Lagometer.isActive())
61 {
62 int i = name.hashCode();
63
64 if (i == HASH_SCHEDULED_EXECUTABLES && name.equals("scheduledExecutables"))
65 {
66 Lagometer.timerScheduledExecutables.start();
67 }
68 else if (i == HASH_TICK && name.equals("tick") && Config.isMinecraftThread())
69 {
70 Lagometer.timerScheduledExecutables.end();
71 Lagometer.timerTick.start();

Callers

nothing calls this directly

Calls 2

getLoggerMethod · 0.45
hashCodeMethod · 0.45

Tested by

no test coverage detected