Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is evCap #63

Closed
yaitskov opened this issue May 23, 2020 · 5 comments
Closed

What is evCap #63

yaitskov opened this issue May 23, 2020 · 5 comments

Comments

@yaitskov
Copy link

Please, comment purpose of evCap field in Event.
Is it a thread id?

@Mikolaj
Copy link
Member

Mikolaj commented May 23, 2020

Hi @yaitskov. I don't remember. Would you mind inserting a markdown link to the line of code? OOI, what are you working on?

@yaitskov
Copy link
Author

yaitskov commented May 23, 2020

@Mikolaj,

https://hackage.haskell.org/package/ghc-events-0.13.0/docs/src/GHC.RTS.EventTypes.html#evCap

Looks like it is polymorphic value depending on EventInfo constructor.

    postEventHeader(eb, tag);

    switch (tag) {
    case EVENT_CREATE_THREAD:   // (cap, thread)
    case EVENT_RUN_THREAD:      // (cap, thread)
    case EVENT_THREAD_RUNNABLE: // (cap, thread)
    {
        postThreadID(eb,thread);
        break;
    }

    case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
    {
        postThreadID(eb,info1 /* spark_thread */);
        break;
    }

    case EVENT_MIGRATE_THREAD:  // (cap, thread, new_cap)
    case EVENT_THREAD_WAKEUP:   // (cap, thread, other_cap)
    {
        postThreadID(eb,thread);
        postCapNo(eb,info1 /* new_cap | victim_cap | other_cap */);
        break;
   }

    case EVENT_STOP_THREAD:     // (cap, thread, status)
    {
        postThreadID(eb,thread);
        postWord16(eb,info1 /* status */);
        postThreadID(eb,info2 /* blocked on thread */);
        break;
    }

I am working on OpenTelemetry.

@Mikolaj
Copy link
Member

Mikolaj commented May 23, 2020

A comment later on provides a hint:

-- | An event annotated with the Capability that generated it, if any
{-# DEPRECATED CapEvent "CapEvents will be removed soon, now Event has a field evCap" #-}

So, this is the capability on which the thread that emitted the event was running. The number indicates a CPU core, in other words. If absent, the even has no associated capability, e.g., is a global marker of a block of events, or something else global.

@Mikolaj
Copy link
Member

Mikolaj commented May 23, 2020

BTW, there are various docs, papers and slides on that (on one I'm a co-author). Search for "Threadscope".

@yaitskov
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants