I am wondering if there is any (performant) way to identify a unique tick in the event loop?
I don't want to do anything like: 1) throw an exception, collect a callstack, analyze it, and hash it, or 2) subprocess any OS or external processes to collect a process / thread ID for uniquness
It should be a language construct. The API I would prefer would be
process.tickId
Adding:
Handle<Value> tick = process->Get(String::New("tickId"));
if (!tick->IsNumber()) {
tick = Number::New(0);
}
process->Set(String::New("tickId"), Number::New(tick->NumberValue() + 1));
To each of the cases of MakeCallback
in node.cc
would provide the counter tickId
. I tested this but I don't know if it leaks memory.