Skip to main content

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 LogiTyme in Cloud Provider:

Checkout the expected output: https://github.com/lmas3009/LogiTyme/blob/main/example/testing-cloud.md

from LogiTyme import LogiTymeCloud
logityme = LogiTymeCloud(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

for i in range(10):
  for j in range(10):
    print(i*j)

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.GenerateReport()

Simple example on how to use LogiTyme in local:

from LogiTyme import LogiTyme

logityme = LogiTyme(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 while running in local:

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, you are good to go...
	- 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.9

    • Introducing LogiTymeCloud
    • Decommission
      • We removed env from LogiTyme(env="local",maxTime=5), now it will be LogiTyme(maxTime=5) or LogiTymeCloud(maxTime=10)
    • Resolved Minor Bugs while Generating Report.
  • 0.0.7 / 0.0.8

    • 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:

Metadata

Release files for LogiTyme 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for LogiTyme 0.0.9
File Size Uploaded
logityme-0.0.9.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LogiTyme 0.0.9
File Interpreter ABI Platform
LogiTyme-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / logityme-0.0.9.tar.gz

Download URL logityme-0.0.9.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4f041e0396e68f95a545e97e473801361c1d60f17c5e6d3723fb5080fd2f2ecf
BLAKE2b-256 checksum
How to use checksums
8fc10ff2ccbfd5821f6154a9aa26d3ebf42c6729782346d21778737140d4651d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / LogiTyme-0.0.9-py3-none-any.whl

Download URL LogiTyme-0.0.9-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b19a783524064c18e20dea7ddba60bdbecbda7b160f573767e2030cf9a46e35
BLAKE2b-256 checksum
How to use checksums
74106e2ce6b82e01623b3bfe4671024267e80b0ff2cf20cd58ed5d7dfb52e073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page