Created
January 18, 2018 21:45
-
-
Save jimblandy/d6489909e8f85cd951b390efbcd9365c to your computer and use it in GitHub Desktop.
Dumb-as-paste function call tracing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnterExit { | |
pid_t pid; | |
char thread_name[100]; | |
const char* label; | |
void* ptr; | |
public: | |
EnterExit(const char* label, void* ptr) | |
: pid(getpid()), | |
label(label), | |
ptr(ptr) | |
{ | |
pthread_getname_np(pthread_self(), thread_name, sizeof(thread_name)); | |
fprintf(stderr, "JIMB %d %-12s %p: Enter %s\n", | |
(int) pid, thread_name, ptr, label); | |
} | |
~EnterExit() { | |
fprintf(stderr, "JIMB %d %-12s %p: Exit %s\n", | |
(int) pid, thread_name, ptr, label); | |
} | |
void log(const char* text) { | |
fprintf(stderr, "JIMB %d %-12s %p: > %s\n", | |
(int) pid, thread_name, ptr, text); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool | |
DispatchDOMEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate, | |
DOMEventTargetHelper* aTarget, bool aIsMainThread) | |
{ | |
EnterExit ee("MessageEventRunnable::DispatchDOMEvent", aWorkerPrivate); | |
... | |
ee.log("queueing runnable for later"); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment