Class EventProfiler
java.lang.Object
dev.despical.whackme.api.EventProfiler
Collects listener execution timings for events dispatched by
EventManager.
Measurements are aggregated per concrete event class using thread-safe counters. In verbose mode each dispatch is also written to the plugin log; otherwise data remains available for the on-demand timings report.
API Note: Profiling measures the complete Bukkit dispatch call, including all registered listeners. It does not identify the execution time of an individual listener.
-
Constructor Summary
ConstructorsConstructorDescriptionEventProfiler(WhackMe plugin) Creates a profiler and loads its enabled and verbose flags. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether event measurements are currently collected.booleanReturns whether every measured dispatch is logged immediately.voidrecord(org.bukkit.event.Event event, long durationNanos) Records one completed event dispatch.voidreload()Reloads profiler flags from the current configuration options.voidsendReport(org.bukkit.command.CommandSender sender) Sends a report ordered by total execution time to the supplied sender.
-
Constructor Details
-
EventProfiler
Creates a profiler and loads its enabled and verbose flags.- Parameters:
plugin- active Whack Me plugin instance
-
-
Method Details
-
isEnabled
public boolean isEnabled()Returns whether event measurements are currently collected.- Returns:
truewhen profiling is enabled
-
isVerbose
public boolean isVerbose()Returns whether every measured dispatch is logged immediately.- Returns:
truewhen verbose profiling is enabled
-
reload
public void reload()Reloads profiler flags from the current configuration options. Existing measurements are retained. -
record
public void record(org.bukkit.event.Event event, long durationNanos) Records one completed event dispatch.- Parameters:
event- dispatched eventdurationNanos- complete dispatch duration in nanoseconds
-
sendReport
public void sendReport(org.bukkit.command.CommandSender sender) Sends a report ordered by total execution time to the supplied sender. A configuration hint is sent instead when profiling is disabled.- Parameters:
sender- report recipient
-