docstr: Test resulst are gathered from multiple threads using ThreadDataLoader.
docstr_tok: ["Test","resulst","are","gathered","from","multiple","threads","using","ThreadDataLoader","."]
code: def test_profile_multithread(self):
      """Test resulst are gathered from multiple threads using ThreadDataLoader."""
      ds = Dataset([self.test_image] * 4, self.scale)
      dl = ThreadDataLoader(
          ds, batch_size=4, num_workers=4, use_thread_workers=True
      )
  
      with WorkflowProfiler() as wp:
          batch = first(dl)
  
      self.assertSequenceEqual(batch.shape, (4, 1, 16, 16, 16))
  
      results = wp.get_results()
      self.assertSequenceEqual(list(results), [self.scale_call_name])
  
      prs = results[self.scale_call_name]
  
      self.assertEqual(len(prs), 4)
  
imports: from __future__ import annotations
  import datetime
  import os
  import unittest
  from io import StringIO
  import torch
  import monai.transforms
  from monai.data import Dataset, ThreadDataLoader
  from monai.utils import first, optional_import
  from monai.utils.enums import CommonKeys
  from monai.utils.profiling import ProfileHandler, ProfileResult, WorkflowProfiler
  from tests.utils import SkipIfNoModule
label_desc: Use image node_id 4 for calling the TestWorkflowProfiler obj's underlying member method code with example usage: obj.test_profile_multithread() without return types