Skip to main content

LogiTyme is a Python package used to track the time spent on each function, custom functions, and the entire Python Program.

Project description

LogiTyme

A Python handler for logityme.

python version


LogiTyme is a Python package used to track the time spent on each function, custom functions, and the entire Python Program

Installation Process:

  1. Install LogiTyme via pip: To install the LogiTyme package, use the following pip command
    pip install LogiTyme
    
  2. Verifify the Installation: After installation, you can verify it by importing LogiTyme in a python script
    import LogiTyme
    print(LogiTyme.__version__)
    

Usage

Simple example on how to use:

from LogiTyme import LogiTyme

logityme = LogiTyme(env="local",maxTime=5)

logityme.StartReport()

@logityme.smart_threshold_check(maxTimeLimit=3)
def slow_function(n):
  result = 0
  for i in range(n):
    for j in range(n):
      result += i*j
      print(result)

  return result



@logityme.smart_threshold_check(maxTimeLimit=2)
def slow_function2(n):
  result = 0
  for i in range(n):
    for j in range(n):
      result += i*j
      print(result)

  return result

slow_function(20)
slow_function2(20)

logityme.LogiFuncStart(name="for-loop", maxLimit=3)
re = 0
for i in range(500):
  for j in range(500):
    re += i * j
    print(re)
logityme.LogiFuncEnd()

logityme.GenerateReport()

Resulted Output:

Performance Analysis

1. Introduction:
	This report presents the findings of a performance analysis conducted on the Python program 'test.py'. The purpose of the analysis is to provide insights into the time consumed by the program and offer recommendations for optimizing its performance.

2. Methodolgy:
	The program was profiled using the cProfile module to collect data on execution time. The collected data was analyzed to identify the functions consuming the most time.

3. Results:
	- Started the program at: 2024-07-17 17:38:14.340244
	- Ended the program at: 2024-07-17 17:38:19.493889
	- Total Execution Time: 5.152 seconds
	- As you defined the threshold limit as 5 mins, Since this script took Less then your threshold limit.
	- memory consumed: 0.0234MB

4. Functions Results:
+----------------+---------------+-----------------------------+
| Function Name  | Time Consumed | Maximum Threshold Limit Set |
+----------------+---------------+-----------------------------+
| slow_function  | 0.004 secs    | 180 secs                    |
| slow_function2 | 0.004 secs    | 120 secs                    |
| for-loop       | 4.549 secs    | 180 secs                    |
+----------------+---------------+-----------------------------+

5. inBuilt-functions Time-Consumed Report:
+----------------------------------+---------------+
| Function Name                    | Time Consumed |
+----------------------------------+---------------+
| <built-in method builtins.print> | 4.556 secs    |
+----------------------------------+---------------+

6. Environment Suggestions:
	- Short tasks (less than 5 minutes):
		-- GCP (Cloud Functions, Compute Engine, GKE, Cloud Run) or AWS (Lambda, EC2, ECS, Step Function, Glue): 
			 Both are well-suited for tasks that complete quickly.
		-- Azure Functions (Consumption Plan, VM, AKS, Container Instances):
			 Good choice for short tasks

7. Code Optimization:
+----------------+---------------+-----------------------------+
| Function Name  | Time Consumed | Maximum Threshold Limit Set |
+----------------+---------------+-----------------------------+
| slow_function  | 0.004 secs    | 180 secs                    |
| slow_function2 | 0.004 secs    | 120 secs                    |
| for-loop       | 4.549 secs    | 180 secs                    |
+----------------+---------------+-----------------------------+
Since this function "slow_function" took 0.004 secs is less then 180 seconds (i.e < 3 mins). The function is quite optimized 
Since this function "slow_function2" took 0.004 secs is less then 120 seconds (i.e < 2 mins). The function is quite optimized 
Since this function "for-loop" took 4.549 secs is less then 180 seconds (i.e < 3 mins). The function is quite optimized 

8. Conclusion:
	The analysis revealed areas for potential optimization in the Python program 'test.py'. By implementing the recommendations outlined in this report, the program's performance can be improved, leading to better overall efficency

Release Version

  • 0.0.7 -Introducing maxTime on LogiTyme

    • LogiTyme(env="local",maxTime=5) used to set the time limt for entire python program. This is for set the threshold limit.
    • Introducing decorators
      • @logityme.smart_threshold_check(maxTimeLimit=2) used to set the time limt for a function. If the limit crossed, It will suggest you for a optimization.
    • Introducing maxLimit on LogiFuncStart
      • logityme.LogiFuncStart(name="for-loop", maxLimit=3) used to keep track of the threshold limit, if it cross the limit, It will suggest you for a optimization.
  • 0.0.2 / 0.0.3 / 0.0.4 / 0.0.5 / 0.0.6

    • Launching LogiTyme
      • Functions Included:
        • StartReport: used to start the process of logging the time for you python program.
        • GenerateReport: used to end the logging process and generate a report based on each function used in the code. Now this will start process the logged data and generate a report based on the time spent in each function used in your code. The generated report will provide insights into the performance if different functions
          • env To run the code in local machine or in cloud machine
          • env = "local" / "cloud"
        • LogiFuncStart & LogiFuncEnd: used to log time for custom code.

Creator Information:

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

logityme-0.0.7.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

LogiTyme-0.0.7-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file logityme-0.0.7.tar.gz.

File metadata

  • Download URL: logityme-0.0.7.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for logityme-0.0.7.tar.gz
Algorithm Hash digest
SHA256 546db1661d91d03a2b8ea3e4af1744dc10518aec93a7d2d9b124b351afd1d8a7
MD5 f2ee1e8f3c1fd6afffff1ad92dd0abd3
BLAKE2b-256 4276f660a52c272b919984646430b09c67407f1bef2a47461f6bb2f54b68f4b9

See more details on using hashes here.

File details

Details for the file LogiTyme-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: LogiTyme-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for LogiTyme-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4d4aa708da837785197144a553b6bcbb587bb606afb68a661c19015cfdddd02b
MD5 2613ebfc6a8341c37117c0ac1db78c99
BLAKE2b-256 d9d6ca140b5dda184d331fdec6ea2d1f03a3f01ec2da0dbcf96bd489498616f0

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