diff --git a/nose2/plugins/prof.py b/nose2/plugins/prof.py
index b24207f..1127f43 100644
--- a/nose2/plugins/prof.py
+++ b/nose2/plugins/prof.py
@@ -1,8 +1,8 @@
 """
-Profile test execution using hotshot.
+Profile test execution using cProfile.
 
 This plugin implements :func:`startTestRun` and replaces
-``event.executeTests`` with :meth:`hotshot.Profile.runcall`. It
+``event.executeTests`` with :meth:`cProfile.Profile.runcall`. It
 implements :func:`beforeSummaryReport` to output profiling information
 before the final test summary time. Config file options ``filename``,
 ``sort`` and ``restrict`` can be used to change where profiling
@@ -15,14 +15,9 @@ entries (`plugin` and `always_on`) in the respective
 sections of the configuration file.
 
 """
-try:
-    import hotshot
-    from hotshot import stats
-except ImportError:
-    hotshot, stats = None, None
+import cProfile
+import pstats
 import logging
-import os
-import tempfile
 
 from nose2 import events, util
 
@@ -41,20 +36,11 @@ class Profiler(events.Plugin):
         self.pfile = self.config.as_str('filename', '')
         self.sort = self.config.as_str('sort', 'cumulative')
         self.restrict = self.config.as_list('restrict', [])
-        self.clean = False
         self.fileno = None
 
-    def register(self):
-        """Don't register if hotshot is not found"""
-        if hotshot is None:
-            log.error("Unable to profile: hotshot module not available")
-            return
-        super(Profiler, self).register()
-
     def startTestRun(self, event):
         """Set up the profiler"""
-        self.createPfile()
-        self.prof = hotshot.Profile(self.pfile)
+        self.prof = cProfile.Profile()
         event.executeTests = self.prof.runcall
 
     def beforeSummaryReport(self, event):
@@ -68,34 +54,16 @@ class Profiler(events.Plugin):
                     event.stream.write(' ')
                 event.stream.flush()
         stream = Stream()
-        self.prof.close()
-        prof_stats = stats.load(self.pfile)
+        prof_stats = pstats.Stats(self.prof, stream=stream)
         prof_stats.sort_stats(self.sort)
         event.stream.writeln(util.ln("Profiling results"))
-        tmp = prof_stats.stream
-        prof_stats.stream = stream
-        try:
-            if self.restrict:
-                prof_stats.print_stats(*self.restrict)
-            else:
-                prof_stats.print_stats()
-        finally:
-            prof_stats.stream = tmp
-        self.prof.close()
-        event.stream.writeln('')
+        if self.restrict:
+            prof_stats.print_stats(*self.restrict)
+        else:
+            prof_stats.print_stats()
 
-        if self.clean:
-            if self.fileno:
-                try:
-                    os.close(self.fileno)
-                except OSError:
-                    pass
-            try:
-                os.unlink(self.pfile)
-            except OSError:
-                pass
+        if self.pfile:
+            prof_stats.dump_stats(self.pfile)
 
-    def createPfile(self):
-        if not self.pfile:
-            self.fileno, self.pfile = tempfile.mkstemp()
-            self.clean = True
+        self.prof.disable()
+        event.stream.writeln('')

[profile plugin] hotshot is broken
In Python there is a 10 years old bug and I stumbled upon it: http://bugs.python.org/issue900092

And quote from python [docs](https://docs.python.org/2/library/hotshot.html) about hotspot:

```
For common usage it is recommended to use cProfile instead. hotshot is not maintained and might be removed from the standard library in the future.
```

So, my proposal is to replace hotspot by cProfile (or something else, actually I'm not familiar with this part of python)

diff --git a/nose2/tests/unit/test_prof_plugin.py b/nose2/tests/unit/test_prof_plugin.py
index 8455d56..b9f61d7 100644
--- a/nose2/tests/unit/test_prof_plugin.py
+++ b/nose2/tests/unit/test_prof_plugin.py
@@ -9,19 +9,20 @@ class TestProfPlugin(TestCase):
 
     def setUp(self):
         self.plugin = prof.Profiler(session=session.Session())
-        self.hotshot = prof.hotshot
-        self.stats = prof.stats
-        prof.hotshot = Stub()
-        prof.stats = Stub()
+        # stub out and save the cProfile and pstats modules
+        self.cProfile = prof.cProfile
+        self.pstats = prof.pstats
+        prof.cProfile = Stub()
+        prof.pstats = Stub()
 
     def tearDown(self):
-        prof.hotshot = self.hotshot
-        prof.stats = self.stats
+        prof.cProfile = self.cProfile
+        prof.pstats = self.pstats
 
     def test_startTestRun_sets_executeTests(self):
         _prof = Stub()
         _prof.runcall = object()
-        prof.hotshot.Profile = lambda filename: _prof
+        prof.cProfile.Profile = lambda: _prof
         event = StartTestRunEvent(runner=None, suite=None, result=None,
                                   startTime=None, executeTests=None)
         self.plugin.startTestRun(event)

pip install -e .[doc]
parse_log_pytest
pytest
nose2 pytest
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
-e git+https://github.com/nose-devs/nose2.git@9583d518b338d70dbccc66604c6ff5ca6cfc912b#egg=nose2
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: nose2
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - mock==5.2.0
      - pygments==2.14.0
      - pytz==2025.2
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-rtd-theme==2.0.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - urllib3==1.26.20
prefix: /opt/conda/envs/nose2

nose2/tests/unit/test_prof_plugin.py::TestProfPlugin::test_startTestRun_sets_executeTests
nose2/plugins/prof.py
nose2/plugins/prof.py