Skip to main content

Time And Memory Profile Parser

Project description

TAMPPA: Time And Memory Profile PArser


As a maiden attampt, I hope to make it super useful for the community. Please report bugs and make pull requests to improve it.


Introduction:

TAMPPA is a supporting package for the popular profilers

Both the packages do an excellent job by providing profiling results on the terminal.

Total time: 0.181071 s
File: main.py
Function: linearRegressionfit at line 35

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
    35                                           @profile
    36                                           def linearRegressionfit(Xt,Yt,Xts,Yts):
    37         1         52.0     52.0      0.1      lr=LinearRegression()
    38         1      28942.0  28942.0     75.2      model=lr.fit(Xt,Yt)
    39         1       1347.0   1347.0      3.5      predict=lr.predict(Xts)
    40                                           
    41         1       4924.0   4924.0     12.8      print("train Accuracy",lr.score(Xt,Yt))
    42         1       3242.0   3242.0      8.4      print("test Accuracy",lr.score(Xts,Yts))

But, there seems to be no method to get these stats in a exportable file that can be used with flexibility.

On dumping the logs to a .txt file still requires an individual to parse data from the text by self and then convert the content into a .csv file; which is a common format for sharing statistical data and plotting using MATPLOTLIB.

This is exactly what TAMPPA does ! It outputs one .csv file per function and another text file func_names.txt and again_func_names.txt for accessing these files easily.

Pre-requisites:

Note: Both the parsers need a .txt file to parse results from

  • Run both the profilers or the profiler whose results you need as a csv, and save the logs on the console to a .txt file. For e.g saving the memory profiling results of the python application mainm.py and saving the results to mem_res_1.txt
$ python -m memory_profiler mainm.py > mem_res_1.txt
  • Avoid printing anything on the console. Try it with python main.py and nothing should be printed to the console. So, comment out all the print and log statements.

Installation

Any particular release can be installed using pip:

$ pip install tamppa

To enter development mode,

$ git clone https://github.com/pra-dan/TAMPPA.git

Usage

Refer to the following once the Installation is over.

Time Profile Parser

Initially, if we have only the .txt file.

.
└── tim_prof_results.txt
0 directories, 1 file

Run tim_parse or time parser, in a Python environment ($ python)

>>> from tamppa import tim_parse
>>> tim_parse("tim_prof_results.txt")

On successful execution, the lonely directory is populated as

.
├── again_func_names.txt
├── import_data_tim_.csv
├── linearRegressionfit_tim_.csv
├── parse_data_tim_.csv
├── randForestRegressorfit_tim_.csv
└── tim_prof_results.txt

0 directories, 6 files

Additionally, a plot is also generated as mem_res

Memory Profile Parser

Similarly, if we have only the .txt file for the memory_profiler.

.
└── mem_res_1.txt

0 directories, 1 file

Run mem_parse or time parser, in a Python environment ($ python)

>>> from tamppa import mem_parse
>>> mem_parse("mem_res_1.txt")

On successful execution, the lonely directory is populated as

.
├── func_names.txt
├── function_wise_time_results.csv
├── import_data_mem_.csv
├── linearRegressionfit_mem_.csv
├── mem_res_1.txt
├── parse_data_mem_.csv
└── randForestRegressorfit_mem_.csv

0 directories, 7 files

Additionally, a plot is also generated as mem_res

TODOs:

  • (Provide the entire package a executable-like interface; such that the parsers can be called simply as $ mem_parse file.txt -plot true)

  • (Add flags to toggle plots for both parsers)

References:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TAMPPA-pra-dan-0.0.1.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TAMPPA_pra_dan-0.0.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file TAMPPA-pra-dan-0.0.1.tar.gz.

File metadata

  • Download URL: TAMPPA-pra-dan-0.0.1.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for TAMPPA-pra-dan-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e2eeafb2278b87bf57abbf64c79ba88e4d319141a376d3967a0fa0638ced4da3
MD5 8dad4b6f128a8fc3f4596a34bea32889
BLAKE2b-256 88d5d5994688dbb38c06fb4d4c5c9f93ee396eaa3b570be193333993aba6dad5

See more details on using hashes here.

File details

Details for the file TAMPPA_pra_dan-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: TAMPPA_pra_dan-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for TAMPPA_pra_dan-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34744ef3d095176ae895374d9da55b2b4430c061b0e766e1ca51c1611eadfc97
MD5 6c7f28a0b5aac65a092d5a2cfa5e4afb
BLAKE2b-256 979ddd0d613557400bb7ed9ba131eee636b9d5b87a455d931692f3d89519776a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page