Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ where `cmhp` is profiling mode, `host` and `port` are hostname and port of
`vprof` server launched in remote mode. Obtained stats will be rendered in new
tab of default web browser, opened by `vprof -r` command.


On the other hand, you can also configure `vprof` server by setting these following environment variables:

* `VPROF__REMOTE_SERVER_HOST`
* `VPROF__REMOTE_SERVER_PORT`

`vprof` can save profile stats to file and render visualizations from
previously saved file.

Expand Down
11 changes: 7 additions & 4 deletions vprof/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

_PROGRAN_NAME = 'vprof'
_MODULE_DESC = 'Visual profiler for Python'
_HOST, _PORT = 'localhost', 8000
_HOST, _PORT = (
os.getenv('VPROF__REMOTE_SERVER_HOST','localhost'),
os.getenv('VPROF__REMOTE_SERVER_PORT', 8000)
)
_CONFIG_DESC = (
"""profile program SRC with configuration CONFIG
available CONFIG options
Expand Down Expand Up @@ -70,11 +73,11 @@ def main():
print('Incorrect profiler version - %s. %s is required.' % (
saved_stats['version'], __version__))
sys.exit(_ERR_CODES['input_file_error'])
stats_server.start(args.host, args.port, saved_stats,
stats_server.start(args.host, int(args.port), saved_stats,
args.dont_start_browser, args.debug_mode)
# Launch in remote mode.
elif args.remote:
stats_server.start(args.host, args.port, {},
stats_server.start(args.host, int(args.port), {},
args.dont_start_browser, args.debug_mode)
# Profiler mode.
else:
Expand All @@ -95,7 +98,7 @@ def main():
outfile.write(json.dumps(program_stats, indent=2))
else:
stats_server.start(
args.host, args.port, program_stats,
args.host, int(args.port), program_stats,
args.dont_start_browser, args.debug_mode)

if __name__ == "__main__":
Expand Down