Commit Graph

36 Commits

Author SHA1 Message Date
Ashley Ruglys
2995db4b5e
Remove the 'active' argument 2021-11-24 11:45:37 +01:00
Ashley Ruglys
cc45865239
Small formatting changes 2021-11-17 11:31:02 +01:00
Ashley Ruglys
91b4058dc4
Implement bare-bones functionality for gpu contexts in the C api 2021-11-17 11:27:52 +01:00
Matej Mulej
036a61f9a4
Fix TracyCAppInfo macro argument name 2021-10-18 20:40:09 +00:00
Simonas Kazlauskas
54ee3d8a94 Expose TRACY_MANUAL_LIFETIME APIs to C API clients
These are extremely useful for ecosystems such as Rust. There are a
couple of reasons why:

1. Rust strongly advises against relying on life before/after main, as
   it is difficult to reason about. Most users working in Rust will
   generally be quite surprised when encountering this concept.
2. Rust and its package manager makes it easy to use packages (crates)
   and somewhat less straightforward to consider the implications of
   including a dependency.

   In case of the `rust_tracy_client` set of packages, I currently have
   to warn throughout the documentation of the package that simply
   adding a dependency on the bindings package is sufficient to
   potentially accidentally broadcast a lot of information about the
   instrumented binary to the broader world. This seems like a major
   footgun given how easy is it to forget about having added this
   dependency.

Ability to manually manage the lifetime of the profiler would be a great
solution to these problems.
2021-09-18 14:54:00 +03:00
Bartosz Taudul
b0fc0d5dcc
Check if rpmalloc has to be initialized before each operation.
The C++11 spec states in [basic.stc.thread] thread storage duration:

2. A variable with thread storage duration shall be initialized before its
   first odr-use (3.2) and, if constructed, shall be destroyed on thread exit.

Previously Tracy relied on the TLS data being initialized:
- During thread creation (MSVC).
- Or during first use in a thread, but the initialization was performed for
  the whole TLS block.

It seems that new compilers are more granular with how they perform the
initialization, hence rpmalloc init has to be checked before each allocation,
as it cannot be "folded" into, for example, initialization of the profiler
itself.
2021-05-31 02:31:42 +02:00
Ben Vanik
b7e1fec37f
Add missing declarations for the _named variants of memory alloc/free. 2021-03-31 14:30:31 -07:00
Stone Tickle
d68cd15173
replace __FUNCTION__ with __func__ from c99 std
https://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

__FUNCTION__ gives warnings with -Wpedantic
2021-03-16 15:51:54 +09:00
Ben Vanik
7dfdad2e02 Adding ZoneColor to set a dynamic color override to an existing zone. 2020-11-27 20:12:24 +01:00
Bartosz Taudul
09203905d6 Support memory pools in the C API. 2020-11-15 15:23:22 +01:00
Bartosz Taudul
73981d4ef3 TracyCSetThreadName() should be always available. 2020-08-04 17:39:36 +02:00
Niclas Olmenius
826affb0b5 add set thread to c api 2020-08-04 11:51:48 +02:00
Bartosz Taudul
4bbeb51e34 Add secure alloc/free macros. 2020-06-24 01:33:26 +02:00
Simonas Kazlauskas
29886435b4 ___tracy_alloc_* take pointer-size pairs
This enables better bindings in languages that do not have 0-terminated
strings for source/function name. It does not introduce any additional
overhead in languages that do use 0-terminated strings, either, but it
_is_ a breaking API change.

Fixes https://github.com/wolfpld/tracy/issues/53
2020-06-20 20:35:42 +03:00
Simonas Kazlauskas
a110b42011 Add ___tracy_init_thread function
This function needs to be called for each non-main thread before calling
the `___tracy_alloc_` functions.

Alternative way to achieve this could be initializing the allocator
transparently in the `___tracy_alloc_*` calls.
2020-06-20 04:22:32 +03:00
Bartosz Taudul
2b304581cf Implement transfer of integral values for zones. 2020-05-24 16:13:09 +02:00
ikrima
dd4c2cf9fa FIX: TracyC Api incorrect spelling of function/build break 2020-05-19 01:22:32 +02:00
Bartosz Taudul
468d3d1077 Add missing include. 2020-05-06 12:50:09 +02:00
Bartosz Taudul
b9cdf2cbb7 Expose srcloc allocation in C API. 2019-12-06 00:25:52 +01:00
Bartosz Taudul
399b87fecc Add allocated srcloc zone begin emit functions to C API. 2019-12-06 00:22:49 +01:00
Bartosz Taudul
60ae748635 Add C API no-callstack redirect macros. 2019-11-14 23:53:35 +01:00
Bartosz Taudul
95e3fb1663 Add missing C API empty macros. 2019-11-14 23:51:01 +01:00
Bartosz Taudul
9f53150a6a Update macros. 2019-11-14 23:50:52 +01:00
Bartosz Taudul
8286b0b72f Plumbing for message call stacks. 2019-11-14 23:40:41 +01:00
Bartosz Taudul
9e1935f070 Make C API symbols visible across dlls. 2019-10-03 22:39:26 +02:00
Alex
0c5ea710b0 Merged in z33ky/tracy/const-frame-image (pull request #37)
Constify frame-image pointer in API.
2019-07-13 13:09:21 +00:00
Alexander 'z33ky' Hirsch
c6e8dc8d63 Constify frame-image pointer in API. 2019-07-13 12:33:55 +02:00
Bartosz Taudul
60d2384a6a Allow sending application information messages. 2019-07-12 18:34:46 +02:00
Bartosz Taudul
f80a0a87bd Remove const qualifier from TracyCZoneCtx.
Some containers don't support storing const types. This struct, as
visible to user, is immutable, so treat it as if const was declared
here.
2019-07-01 19:16:15 +02:00
Bartosz Taudul
9ca254307a Add callstack versions of C API macros. 2019-06-24 21:10:41 +02:00
Bartosz Taudul
c749a2e3fe Add C API for plots and messages. 2019-06-24 21:03:39 +02:00
Bartosz Taudul
48e08acb62 Add C API for frame markup. 2019-06-24 21:03:39 +02:00
Bartosz Taudul
ee99ce833c Implement memory allocation tracking for C API. 2019-06-24 21:03:39 +02:00
Bartosz Taudul
a708bebbfd Use language neutral header for callstack capability detection.
This fixes call stack collection in C API when TRACY_CALLSTACK is
defined.
2019-01-27 13:41:32 +01:00
Bartosz Taudul
92f3a4bba0 Add ZoneText and ZoneName to the C API. 2019-01-16 02:10:21 +01:00
Bartosz Taudul
1f0d1fdfdc C API prototype. 2019-01-14 21:07:29 +01:00