Class SlimefunProfiler
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.services.profiler.SlimefunProfiler
The 
SlimefunProfiler works closely to the TickerTask and is
 responsible for monitoring that task.
 It collects timings data for any ticked Block and the corresponding SlimefunItem.
 This allows developers to identify laggy SlimefunItems or SlimefunAddons.
 But it also enables Server Admins to locate lag-inducing areas on the Server.- Author:
 - TheBusyBiscuit
 - See Also:
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionlongcloseEntry(Location l, SlimefunItem item, long timestamp) This method closes a previously started entry.doubleGet and reset the average nanosecond timing for thisSlimefunProfiler.longGet and reset the average millisecond timing for thisSlimefunProfiler.doubleGet and reset the average millisecond timing for each machine.protected intgetBlocksFromPlugin(String pluginName) protected intgetBlocksInChunk(String chunk) protected intgetBlocksOfId(String id) protected floatThis method returns the currentPerformanceRating.intgetTime()getTime(SlimefunItem item) booleanhasTimings(Block b) This method checks whether theSlimefunProfilerhas collected timings on the givenBlockvoidkill()This method terminates theSlimefunProfiler.longnewEntry()This method starts a new profiler entry.voidrequestSummary(PerformanceInspector inspector) This method requests a summary for the givenPerformanceInspector.voidscheduleEntries(int amount) This method schedules a given amount of entries for the future.voidstart()This method starts the profiling, data from previous runs will be cleared.voidstop()This stops the profiling. 
- 
Constructor Details
- 
SlimefunProfiler
public SlimefunProfiler() 
 - 
 - 
Method Details
- 
kill
public void kill()This method terminates theSlimefunProfiler. We need to call this method when theServershuts down to prevent any of ourThreadsfrom being kept alive. - 
start
public void start()This method starts the profiling, data from previous runs will be cleared. - 
newEntry
public long newEntry()This method starts a new profiler entry.- Returns:
 - A timestamp, best fed back into 
closeEntry(Location, SlimefunItem, long) 
 - 
scheduleEntries
public void scheduleEntries(int amount) This method schedules a given amount of entries for the future. Be careful tocloseEntry(Location, SlimefunItem, long)all of them again! NoPerformanceSummarywill be sent until all entries were closed. If the specified amount is negative, scheduled entries will be removed- Parameters:
 amount- The amount of entries that should be scheduled. Can be negative
 - 
closeEntry
This method closes a previously started entry. Make sure to callnewEntry()to get the timestamp in advance.- Parameters:
 l- TheLocationof ourBlockitem- TheSlimefunItemat thisLocationtimestamp- The timestamp marking the start of this entry, you can retrieve it usingnewEntry()- Returns:
 - The total timings of this entry
 
 - 
stop
public void stop()This stops the profiling. - 
requestSummary
This method requests a summary for the givenPerformanceInspector. The summary will be sent upon the next available moment in time.- Parameters:
 inspector- ThePerformanceInspectorwho shall receive this summary.
 - 
getByItem
 - 
getByPlugin
 - 
getByChunk
 - 
getBlocksInChunk
 - 
getBlocksOfId
 - 
getBlocksFromPlugin
 - 
getPercentageOfTick
protected float getPercentageOfTick() - 
getPerformance
This method returns the currentPerformanceRating.- Returns:
 - The current performance grade
 
 - 
getTime
 - 
getTickRate
public int getTickRate() - 
hasTimings
This method checks whether theSlimefunProfilerhas collected timings on the givenBlock - 
getTime
 - 
getTime
 - 
getTime
 - 
getAndResetAverageTimings
public long getAndResetAverageTimings()Get and reset the average millisecond timing for thisSlimefunProfiler.- Returns:
 - The average millisecond timing for this 
SlimefunProfiler. 
 - 
getAndResetAverageNanosecondTimings
public double getAndResetAverageNanosecondTimings()Get and reset the average nanosecond timing for thisSlimefunProfiler.- Returns:
 - The average nanosecond timing for this 
SlimefunProfiler. 
 - 
getAverageTimingsPerMachine
public double getAverageTimingsPerMachine()Get and reset the average millisecond timing for each machine.- Returns:
 - The average millisecond timing for each machine.
 
 
 -