user1992634
user1992634

Reputation: 784

Identify core an Erlang process

Any way to identify the specific core an Erlang process is scheduled on?

Let's say you spawn a bunch of processes to simply print out the core the process is running on, and then exit. Any way to do this?

I spent some time reading docs and googling but couldn't find anything.

Thanks.

EDIT: "core" = CPU core number (or if not number, another identifier that identifies the CPU core).

Upvotes: 3

Views: 305

Answers (2)

I GIVE CRAP ANSWERS
I GIVE CRAP ANSWERS

Reputation: 18869

No there is not. If you spawn 2000 processes and they terminate quickly, chances are that you will finish the job before rebalancing occurs. In this case you would only have a single core operating all the time.

You could take a look at the scheduler utilization calls however, see erlang:statistics(scheduler_wall_time). It will tell you how much work each scheduler is really doing.

Upvotes: 2

Dmitry Belyaev
Dmitry Belyaev

Reputation: 2593

There is erlang:system_info(scheduler_id) that in most cases is maped to a logical core. But this information is pretty ephemeral because the process may be suspended and resumed on any other scheduler.

What is your use case that you really need that kind of information?

Upvotes: 4

Related Questions