# Path: pyinstrument/stack_sampler.py
# class StackSamplerSubscriber:
# class StackSampler:
#     class SubscriberNotFound(Exception):
# class AsyncState(NamedTuple):
#     def __init__(
#         self,
#         *,
#         target: StackSamplerSubscriberTarget,
#         desired_interval: float,
#         bound_to_async_context: bool,
#         async_state: AsyncState | None,
#     ) -> None:
#     def __init__(self) -> None:
#     def subscribe(
#         self,
#         target: StackSamplerSubscriberTarget,
#         desired_interval: float,
#         use_async_context: bool,
#     ):
#     def unsubscribe(self, target: StackSamplerSubscriberTarget):
#     def _update(self):
#     def _start_sampling(self, interval: float):
#     def _stop_sampling(self):
#     def _sample(self, frame: types.FrameType, event: str, arg: Any):
#     def _timer(self):
# def get_stack_sampler() -> StackSampler:
# def build_call_stack(frame: types.FrameType | None, event: str, arg: Any) -> list[str]:
# 
# Path: test/util.py
# def do_nothing():
#     pass


import contextvars
import sys
import time
import pytest
from pyinstrument import stack_sampler
from .util import do_nothing





class SampleCounter:
    count = 0

    def sample(self, stack, time, async_state):
        self.count += 1


def test_create():
    sampler = stack_sampler.get_stack_sampler()
    assert sampler is not None


# Path: pyinstrument/stack_sampler.py
# class StackSamplerSubscriber:
# class StackSampler:
#     class SubscriberNotFound(Exception):
# class AsyncState(NamedTuple):
#     def __init__(
#         self,
#         *,
#         target: StackSamplerSubscriberTarget,
#         desired_interval: float,
#         bound_to_async_context: bool,
#         async_state: AsyncState | None,
#     ) -> None:
#     def __init__(self) -> None:
#     def subscribe(
#         self,
#         target: StackSamplerSubscriberTarget,
#         desired_interval: float,
#         use_async_context: bool,
#     ):
#     def unsubscribe(self, target: StackSamplerSubscriberTarget):
#     def _update(self):
#     def _start_sampling(self, interval: float):
#     def _stop_sampling(self):
#     def _sample(self, frame: types.FrameType, event: str, arg: Any):
#     def _timer(self):
# def get_stack_sampler() -> StackSampler:
# def build_call_stack(frame: types.FrameType | None, event: str, arg: Any) -> list[str]:
# 
# Path: test/util.py
# def do_nothing():
#     pass


# Path: test/test_stack_sampler.py
import contextvars
import sys
import time
import pytest
from pyinstrument import stack_sampler
from .util import do_nothing






class SampleCounter:
    count = 0

    def sample(self, stack, time, async_state):
        self.count += 1


def test_create():
    sampler = stack_sampler.get_stack_sampler()
    assert sampler is not None


    assert sampler is stack_sampler.get_stack_sampler()