Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add energy measurements support #140

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyperformance/_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _resolve_restricted_opts(opts):
if opt.startswith(FLAG + '='):
idx = i + 1
resolved.append(FLAG)
resolved.append(opt.partition('=')[-2])
resolved.append(opt.partition('=')[-1])
resolved.extend(opts[idx:])
break
elif opt == FLAG:
Expand Down
2 changes: 2 additions & 0 deletions pyperformance/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def parse_args():
cmd.add_argument("--append", metavar="FILENAME",
help="Add runs to an existing file, or create it "
"if it doesn't exist")
cmd.add_argument("--track-energy", action="store_true",
help="Track energy instead of wall clock time.")
filter_opts(cmd)

# show
Expand Down
2 changes: 1 addition & 1 deletion pyperformance/data-files/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ psutil==5.8.0
# via -r requirements.in
pyparsing==3.0.6
# via packaging
pyperf==2.3.0
pyperf @ file:///home/cappadokes/code/pyperf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like something you changed locally, but that should be changed back before landing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is somewhat tricky:

  • for --track-energy to work, pyperf should also support energy measurements. There is no such pyperf release at the moment, but we are working on it.
  • until then, if a user wants to use --track-energy from pyperformance, she must indeed use a local pyperf in requirements.txt.

# via -r requirements.in
toml==0.10.2
# via -r requirements.in
2 changes: 2 additions & 0 deletions pyperformance/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,7 @@ def get_pyperf_opts(options):
opts.append('--track-memory')
if options.inherit_environ:
opts.append('--inherit-environ=%s' % ','.join(options.inherit_environ))
if options.track_energy:
opts.append('--track-energy')

return opts