Commit Graph

52 Commits

Author SHA1 Message Date
Bartosz Taudul
0d2e7f72a7 Move GetThreadHandleImpl() from header to source file.
This removes dependency on unistd.h header (required for syscall() on
linux), which includes a definition of getopt(), which may conflict with
a custom getopt implementation (for example, one that does work on
windows).
2020-02-11 14:40:49 +01:00
Bartosz Taudul
aa94df0845 Replace rpmalloc_thread_initialize with InitRPMallocThread(). 2020-01-25 17:16:08 +01:00
Bartosz Taudul
a90004b983 Move Set/GetThreadName() to Tracy API. 2020-01-25 16:36:58 +01:00
Bartosz Taudul
6f31eb2a9d Disable MSVC idiocy. 2020-01-20 22:49:03 +01:00
Bartosz Taudul
4eaa3d90dd Thread ids are no longer pthread_t. 2019-12-13 15:57:08 +01:00
Bartosz Taudul
0f6101b19a Fix mingw/cygwin thread name setter/getter. 2019-11-07 18:58:08 +01:00
Bartosz Taudul
71b54dd48a Always collect thread names.
This fixes an issue when a thread was destroyed before its name could be
retrieved.
2019-08-14 16:52:04 +02:00
Bartosz Taudul
92b6da7cc2 SetThreadName() only works on the current thread.
This breaking change is required, because kernel trace facilities use
kernel thread ids, which are inaccessible from the pthread_t level.
2019-08-14 02:22:45 +02:00
Bartosz Taudul
8925d026a9 Cosmetics. 2019-08-14 01:57:36 +02:00
Bartosz Taudul
73cbf2eead Use windows thread ids on cygwin. 2019-08-13 16:22:58 +02:00
Bartosz Taudul
94b470ba66 Chomp newline from end of thread string. 2019-07-03 16:12:37 +02:00
Rokas Kupstys
9bd1037347 Clean up imported functions in multi-dll projects. 2019-06-07 19:50:08 +03:00
Bartosz Taudul
ef5e30056e Implement delayed initialization of the profiler.
Enabled on osx, ios.
2019-02-19 20:43:30 +01:00
Bartosz Taudul
3f914834b7 Hide rest of statics. 2019-02-19 19:33:37 +01:00
Rokas Kupstys
8157e3a0b3 Fix builds with MingW. 2019-01-19 13:53:10 +02:00
Bartosz Taudul
560fc34ae6 No pthread_setcancelstate on Android. 2018-09-07 17:21:44 +02:00
Till Rathmann
4968717313 Fixed compiler warning about unused variable in release builds. 2018-08-02 11:45:15 +02:00
Till Rathmann
37d5736bf5 Fixed compiler warnings. 2018-08-01 14:07:30 +02:00
Till Rathmann
dd042619e9 Support for multi-DLL projects. 2018-07-31 12:06:04 +02:00
Arvid Gerstmann
dfe3285252 Merged in Leandros99/tracy/pr-1 (pull request #11)
Implement pthread_getname_np alternative if it's not available
2018-07-24 11:57:21 +00:00
Arvid Gerstmann
69dac3f611 Fix accessing the thread id on Android 2018-07-24 13:43:25 +02:00
Rokas Kupstys
01df5aa840 Fix targetting lower windows versions when using W10 SDK that is older than redstone2. 2018-07-19 11:08:41 +03:00
Rokas Kupstys
d290e04d45 Fix build when targeting earlier windows versions by defining _WIN32_WINNT. 2018-07-17 20:15:27 +03:00
Arvid Gerstmann
f04e67779c Fix some minor code style issues 2018-07-14 13:46:25 +02:00
Arvid Gerstmann
6fb73a3d97 Implement getname alternative if it's not available 2018-07-14 13:26:55 +02:00
Tobias Widlund
b6cce4ddb6 Improve fixes for warnings as per request 2018-06-30 15:36:06 +02:00
Tobias Widlund
1c467a5847 Fix warning re shadowing, implicit conversion and added include <cstdio> 2018-06-30 11:47:27 +02:00
Bartosz Taudul
56bd01dfd1 Don't copy thread name needlessly. 2018-03-31 01:38:57 +02:00
Bartosz Taudul
813e265bc3 Initialize rpmalloc in SetThreadName().
There's no guarantee that rpmalloc will be initialized when the thread
calls SetThreadName, due to thread_local storage initialization rules.
2018-03-30 14:39:25 +02:00
Bartosz Taudul
ab1f93194e No thread names on emscripten. 2017-11-29 11:11:16 +01:00
Bartosz Taudul
f71af873c0 Proper function name. 2017-11-03 11:13:02 +01:00
Bartosz Taudul
7ecc6b54d4 Proper pthread_threadid_np call. 2017-11-03 11:12:17 +01:00
Bartosz Taudul
c7cb89307f Use proper __APPLE__ macro. 2017-11-03 11:09:31 +01:00
Bartosz Taudul
1d9542ea25 Fix thread ids on osx, iphone. 2017-11-03 10:49:49 +01:00
Bartosz Taudul
3051b8d27c Don't use rpmalloc directly. 2017-11-02 12:58:38 +01:00
Bartosz Taudul
391571a2da Fix android with tracy disabled. 2017-10-31 11:36:43 +01:00
Bartosz Taudul
aa12a3bf94 Missing include. 2017-10-30 21:51:24 +01:00
Bartosz Taudul
cf3d8eb810 Manual collection of thread names on android. 2017-10-30 20:45:00 +01:00
Bartosz Taudul
5cf962e03d Android has pthread_setname_np, but not getname... 2017-10-30 13:48:52 +01:00
Bartosz Taudul
d21040e3d8 pthread_{get,set}name_np is not standard. 2017-10-28 12:16:52 +02:00
Bartosz Taudul
1788408ceb Allow setting thread name using thread handle. 2017-10-16 21:17:58 +02:00
Bartosz Taudul
f156cd922b OpenThread may fail. 2017-10-15 13:26:05 +02:00
Bartosz Taudul
75457c1465 Remove +x flag from files. 2017-10-10 21:56:15 +02:00
Bartosz Taudul
809d98162b Do the same trick as concurrentqueue.h for GetCurrentThreadId(). 2017-09-26 00:46:46 +02:00
Bartosz Taudul
1c4dcf7e52 Use consistent ifdefs. 2017-09-26 00:42:47 +02:00
Bartosz Taudul
206305fbd2 Merge TracyThread.hpp to TracySystem.cpp.
Keeping threading functions inside a source file prevents poisoning by
including windows.h.
2017-09-25 21:13:59 +02:00
Bartosz Taudul
e1a63dbb53 Drop constant merging check.
While without constant merging the profiler operates sub-optimally, it's
not that essential to be enabled. And there are problems with it on some
platforms, for example cygwin.
2017-09-23 20:16:42 +02:00
Bartosz Taudul
6c1d014aa3 Fix implementation errors. 2017-09-22 21:48:21 +02:00
Bartosz Taudul
bd622c304a Limit pthread thread name to 16 bytes.
This is a documented pthread restriction. Passing longer strings has no
effect (i.e. thread name is not set).
2017-09-22 21:45:35 +02:00
Bartosz Taudul
6885dc3fd3 Restore support for old SDK versions. 2017-09-22 00:37:28 +02:00