class ThreadSampler

Defined at line 69 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

Public Methods

zx::result<> SetUp (const zx_sampler_config_t & config)

Defined at line 31 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

void ThreadSampler ()

Defined at line 71 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

void ~ThreadSampler ()

Defined at line 72 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

SamplingState State ()

Defined at line 74 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

zx::result<> Start ()

Defined at line 95 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

ktl::optional<PerCpuBufferRef> GetBufferRefForWriting (cpu_num_t cpu_num)

Atomically acquire a reference to the buffer for `cpu_num` and ensure that the buffers are not

destroyed until the reference is released.

Defined at line 107 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

zx::result<> Stop ()

Defined at line 108 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

ktl::optional<ReadToken> GetBufferRefForReading ()

Atomically acquire a reference to the buffer for `cpu_num` and ensure that the buffers are not

destroyed until the reference is released.

Defined at line 149 of file ../../zircon/kernel/lib/thread_sampler/include/lib/thread_sampler/thread_sampler.h

zx::result<> Destroy ()

Defined at line 163 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

ktl::pair<zx_status_t, size_t> ReadUser (user_out_ptr<void> ptr, size_t len)

ReadUser calls into VmObject::ReadUser. As we could be copying to pager backed user memory, we

must not hold any locks.

Defined at line 337 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

void ScheduleMarking ()

Atomically request the current cpu mark a thread for sampling if the session is Running.

Defined at line 402 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

void RescheduleMarking ()

Atomically rerequest the current cpu mark a thread for sampling if the session is Running.

Avoids modifying the ref count unless the session has stopped.

Defined at line 437 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

void CancelMarking ()

Atomically cancel a request that the current cpu mark a thread for sampling.

Defined at line 452 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

zx::result<> SampleThread (zx_koid_t pid, zx_koid_t tid, GeneralRegsSource source, const void * gregs, uint64_t session_id)

Given information about a thread and its registers, walk its userstack and write out a sample

if sampling is enabled.

Defined at line 204 of file ../../zircon/kernel/lib/thread_sampler/thread_sampler.cc

Records

Friends

class TestThreadSampler