Skip to content

Commit

Permalink
Merge pull request dylan-lang#1042 from waywardmonkeys/export-simple-…
Browse files Browse the repository at this point in the history
…profiling-api

[common-dylan] Export start-profiling, stop-profiling.
  • Loading branch information
waywardmonkeys committed Apr 4, 2016
2 parents 2d7d96b + 77e9424 commit 373ccc0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
Expand Up @@ -126,6 +126,18 @@ may be useful in some scenarios.
.. method:: profiling-type-result
:specializer: <profiling-state>, singleton(#"allocation-stats")

.. function:: start-profiling

:signature: start-profiling (profiling-types) => (state)

:parameter profiling-types: A sequence of any of ``#"cpu-time-seconds"``,
``#"cpu-time-microseconds"``, ``#"allocation#`` and
``#"allocation-stats#``.
:value state: An instance of :type:`<profiling-state>`.

This is useful for when direct control over profiling is needed rather
than using the :macro:`profiling` macro.

.. generic-function:: start-profiling-type
:open:

Expand All @@ -143,6 +155,14 @@ may be useful in some scenarios.
.. method:: start-profiling-type
:specializer: <profiling-state>, singleton(#"allocation-stats")

.. function:: stop-profiling

:signature: stop-profiling (state profiling-types) => ()

:parameter state: An instance of :type:`<profiling-state>`.
:parameter profiling-types: A sequence of :drm:`<symbol>`. These
symbols should be the same as those passed to :func:`start-profiling`.

.. generic-function:: stop-profiling-type
:open:

Expand Down
4 changes: 4 additions & 0 deletions documentation/release-notes/source/2016.1.rst
Expand Up @@ -106,6 +106,10 @@ Common Dylan
* The ``thread`` module has gained a ``current-thread-id`` function. The
``thread-id`` is also available for any ``<thread>`` object.

* The ``simple-profiling`` module now exports ``start-profiling`` and
``stop-profiling`` rather than requiring that users directly invoke
``start-profiling-type`` and ``stop-profiling-type`` multiple times.

Compiler
========

Expand Down
2 changes: 2 additions & 0 deletions sources/common-dylan/library.dylan
Expand Up @@ -32,7 +32,9 @@ define module simple-profiling

create \profiling,
<profiling-state>,
start-profiling,
start-profiling-type,
stop-profiling,
stop-profiling-type,
profiling-type-result;
end module simple-profiling;
Expand Down
8 changes: 8 additions & 0 deletions sources/common-dylan/tests/functions.dylan
Expand Up @@ -771,10 +771,18 @@ end function-test random;

/// simple-profiling tests

define simple-profiling function-test start-profiling ()
//---*** Fill this in...
end function-test start-profiling;

define simple-profiling function-test start-profiling-type ()
//---*** Fill this in...
end function-test start-profiling-type;

define simple-profiling function-test stop-profiling ()
//---*** Fill this in...
end function-test stop-profiling;

define simple-profiling function-test stop-profiling-type ()
//---*** Fill this in...
end function-test stop-profiling-type;
Expand Down
2 changes: 2 additions & 0 deletions sources/common-dylan/tests/specification.dylan
Expand Up @@ -204,8 +204,10 @@ end module-spec simple-random;

define module-spec simple-profiling ()
sealed instantiable class <profiling-state> (<table>);
function start-profiling(<sequence>) => (<profiling-state>);
open generic-function start-profiling-type
(<profiling-state>, <symbol>) => ();
function stop-profiling(<profiling-state>, <sequence>) => ();
open generic-function stop-profiling-type
(<profiling-state>, <symbol>) => ();
open generic-function profiling-type-result
Expand Down

0 comments on commit 373ccc0

Please sign in to comment.