Skip to content

Commit

Permalink
Profile: on Windows, sample at 10ms intervals.
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Dec 4, 2014
1 parent e7ce4cb commit 6352de9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion base/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end

# init with default values
# Use a max size of 1M profile samples, and fire timer every 1ms
__init__() = init(1_000_000, 0.001)
@windows? (__init__() = init(1_000_000, 0.01)) : (__init__() = init(1_000_000, 0.001))

clear() = ccall(:jl_profile_clear_data, Void, ())

Expand Down
12 changes: 9 additions & 3 deletions doc/stdlib/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ sequence of function calls up to and including this line---is
proportional to how often it appears in the set of all backtraces.

A sampling profiler does not provide complete line-by-line coverage,
because the backtraces occur at intervals (by default, 1 ms). However,
this design has important strengths:
because the backtraces occur at intervals (by default, 1 ms on Unix
systems and 10 ms on Windows, although the actual scheduling is
subject to operating system load). Moreover, as discussed further
below, because samples are collected at a sparse subset of all
execution points, the data collected by a sampling profiler is subject
to statistical noise.

Despite these limitations, sampling profilers have substantial strengths:

- You do not have to make any modifications to your code to take
timing measurements (in contrast to the alternative `instrumenting
profiler <https://github.com/timholy/IProfile.jl>`_).
- It can profile into Julia's core code and even (optionally) into C
and Fortran libraries.
- By running "infrequently" there is very little performance overhead;
while profiling, your code will run at nearly native speed.
while profiling, your code can run at nearly native speed.

For these reasons, it's recommended that you try using the built-in
sampling profiler before considering any alternatives.
Expand Down

0 comments on commit 6352de9

Please sign in to comment.