code: def test_profile_event(do_enable_profiler=True):
      def makeParams():
          objects = tuple("foo" for _ in range(50))
          template = "".join(f"{{{i}}}" for i in range(len(objects)))
          return template, objects
  
      def get_log():
          template, objects = makeParams()
          logs = []
          for _ in range(100000):
              logs.append(template.format(*objects))
          return logs
  
      if do_enable_profiler is True:
          enable_profiler("test_profile_event.json")
      event = profiler.Event("test_profile_event")
      event.start()
      start = time.time()
      var = mx.nd.ones((1000, 500))
      assert len(get_log()) == 100000
      var.asnumpy()
      stop = time.time()
      event.stop()
      assert stop > start
      if do_enable_profiler is True:
          profiler.set_state("stop")
  
imports: from __future__ import print_function
  import time
  import os
  import csv
  import json
  import numpy
  from collections import OrderedDict
  import mxnet
  from mxnet import profiler
  from mxnet.gluon import nn
  from mxnet.test_utils import is_cd_run
  from common import run_in_spawned_process
  import pytest
label_desc: Use image node_id 7 for calling a global function with example usage: test_profile_event(do_enable_profiler) and returns: template,  objects, logs