Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ use this snippet:

.. code-block:: cpp

uint64_t begin = OS::get_singleton()->get_ticks_usec();
uint64_t begin = Time::get_singleton()->get_ticks_usec();

// Your code here...

uint64_t end = OS::get_singleton()->get_ticks_usec();
uint64_t end = Time::get_singleton()->get_ticks_usec();
print_line(vformat("Snippet took %d microseconds", end - begin));

This will print the time spent between the ``begin`` declaration and the ``end``
Expand Down
4 changes: 2 additions & 2 deletions tutorials/performance/cpu_optimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ the following:

::

var time_start = OS.get_ticks_usec()
var time_start = Time.get_ticks_usec()

# Your function you want to time
update_enemies()

var time_end = OS.get_ticks_usec()
var time_end = Time.get_ticks_usec()
print("update_enemies() took %d microseconds" % time_end - time_start)

When manually timing functions, it is usually a good idea to run the function
Expand Down