DimaA6_ABC
DimaA6_ABC

Reputation: 622

Access dtrace probe from C program

There is runocc.d dtrace script which prints run queue for each processor. I need to get run queue length in my C++ program on Mac OS X. Is it possible to somehow embed dtrace constructs into C++ program?

Upvotes: 0

Views: 580

Answers (1)

DimaA6_ABC
DimaA6_ABC

Reputation: 622

OK, found that there is dtrace API, though it is "private" and "not stable", and it seems that you cannot ask for the value of the probe just once - you need to start monitoring and then periodically poll the probe. Since this is not the highest priority in our project, I will not immediately try it but good to know it exists - http://www.osdevcon.org/2008/files/osdevcon2008-petr.pdf

Also quick check confirmed there is a file /usr/include/dtrace.h and it does have the functions mentioned in the PDF.

Upvotes: 1

Related Questions