Maby somebody need this to watch how much time plugin or part of plugin run in time.
In console you will see time in second that that plugin execute.
insert this in your plugin or monito what plugin was doing
s_time = time.perf_counter()
**#CODE_HERE**
e_time = time.perf_counter()
print(e_time - s_time, "seconds")
#print('{:%H:%M:%S.%f}'.format(datetime.utcfromtimestamp(e_time - s_time)))
For example to plugin insert date:
save this in your Packages/User folder (with the .py extension):Source where i get example plugin
import time
class InsertDatetimeCommand(sublime_plugin.TextCommand):
def run(self, edit):
s_time = time.perf_counter()
sel = self.view.sel();
for s in sel:
self.view.replace(edit, s, time.ctime())
e_time = time.perf_counter()
print("InsertDatetime")
print(e_time - s_time, "seconds")
#next command convert seconds to format 00:00:00
# print('{:%H:%M:%S.%f}'.format(datetime.utcfromtimestamp(e_time - s_time)))
output text in console will be
InsertDatetime
0.0015705049991083797 seconds
You can also use the print command anywhere in text, for example to display information that part of the code is complete
Just write in quotes
Print("Some tex")
If there are more plugins or interesting life hacks for monitoring plugins and understanding what sometimes slows things down.
Please write.