code: def test_basic():
      def test_g():
          sleep(0.01)
  
      def test_h():
          sleep(0.02)
  
      def test_f():
          for _ in range(100):
              test_g()
              test_h()
  
      thread = threading.Thread(target=test_f)
      thread.daemon = True
      thread.start()
  
      state = create()
  
      for _ in range(100):
          sleep(0.02)
          frame = sys._current_frames()[thread.ident]
          process(frame, None, state)
  
      assert state["count"] == 100
      d = state
      while len(d["children"]) == 1:
          d = first(d["children"].values())
  
      assert d["count"] == 100
      assert "test_f" in str(d["description"])
      g = [
          c
          for c in d["children"].values()
          if "test_g" in str(c["description"])
      ][0]
      h = [
          c
          for c in d["children"].values()
          if "test_h" in str(c["description"])
      ][0]
  
      assert g["count"] < h["count"]
      assert 95 < g["count"] + h["count"] <= 100
  
      pd = plot_data(state)
      assert len(set(map(len, pd.values()))) == 1  # all same length
      assert len(set(pd["color"])) > 1
  
imports: from __future__ import annotations
  import dataclasses
  import sys
  import threading
  from collections.abc import Iterator, Sequence
  from time import sleep
  import pytest
  from tlz import first
  from distributed.compatibility import WINDOWS
  from distributed.metrics import time
  from distributed.profile import call_stack, create, identifier, info_frame, ll_get_stack, llprocess, lock, merge, plot_data, process, watch
label_desc: Use image node_id 1 for calling a global function with example usage: test_basic() without return types