Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kspviswa/thinloggermt
Slim buffer to enable instrumentation in run time. Suitable for multi-threading application
https://github.com/kspviswa/thinloggermt
Last synced: 14 days ago
JSON representation
Slim buffer to enable instrumentation in run time. Suitable for multi-threading application
- Host: GitHub
- URL: https://github.com/kspviswa/thinloggermt
- Owner: kspviswa
- License: mit
- Created: 2014-08-03T18:28:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-24T12:18:43.000Z (over 9 years ago)
- Last Synced: 2024-10-11T18:55:15.745Z (about 1 month ago)
- Language: C
- Size: 366 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
thinloggerMT
============Slim buffer to enable instrumentation in run time. Suitable for multi-threading application
Sometime logging to a file, won't help to debug issues.
For example, data corruption can happen if more than single thread, try to read & write
the shared resource at the same time.But the scenario in which, these 2 threads come into picture, may be strongly dicdated by time.
There are cases where in such scenarion happens randomly @ certain instants.Inorder to debug those issues, file logging may not be worth, since every I/O call calls for a latency.
The _race condition_ may not occur at all, if you introduce a delay.thinloggerMT may be useful for these situations.
ThinloggerMT is a simple ringle-buffer implementation, where the buffers are indexed with the thread-id.
i.e Each thread has its own log buffer and these buffers are in-turn related to each other.Since each thread, has its own buffer, these threads don't depend on each other.
Hence there is no need for the threads to wait for a lock, thereby increasing the log-time of the threads.These buffers are maintained in global state. As of now, if process core-dumps, then these buffers
could be examined from the core-file.For more information on how to debug with the instrumentation enabled, visit my blog about this project
http://kspviswa.wordpress.com/2014/10/03/lock-free-thread-based-log-buffer-implementation-for-debugging-high-performance-multi-threaded-app/Future works have been planned, to dump the instrumentation on-demand basis or shared memory.
This buffer has been provided in a static lib format.Steps
=====1) Define your own instrumentation info in THINLOGBUFFER struct.
2) Avoid using custom types. Live with primitive types.
3) Avoid pointers. If you do so, then focus on fill() to fill your pointees.
4) Include thinLoggerMT.h in your source.
5) call init() once and call doInstrumentation() with a pointer to THINLOGBUFFER struct N number of times you want.===============================================
Viswa [kspviswa.wordpress.com]