LogiTyme


NameLogiTyme JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/lmas3009/LogiTyme
SummaryLogiTyme is a Python package used to track the time spent on each function, custom functions, and the entire Python Program.
upload_time2024-07-18 04:42:58
maintainerNone
docs_urlNone
authorAravind Kumar Vemula
requires_python>=3.8
licenseNone
keywords logging analyzing
VCS
bugtrack_url
requirements terminaltables
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<h1 align="center">LogiTyme</h1>
<p align="center">A Python handler for <a href="https://github.com/lmas3009/LogiTyme"><i>logityme</i></a>.</p>

[//]: # ([![python compatibility]&#40;https://github.com/lmas3009/LogiTyme/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions/badge.svg&#41;]&#40;https://github.com/lmas3009/LogiTyme/actions/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions.yml&#41;)
[![python version](https://img.shields.io/badge/Works_With_Python-3.8,%203.9,%203.10,%203.11-orange)](https://github.com/lmas3009/LogiTyme/actions/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions.yml)

---

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

- Python package repo link: https://pypi.org/project/LogiTyme/


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


# *Usage*

Simple example on how to use:
```bash
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:_**
```text

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.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*:
- Created By: Aravind Kumar Vemula
- Twitter: https://x.com/AravindKumarV09
- Github: https://github.com/lmas3009


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lmas3009/LogiTyme",
    "name": "LogiTyme",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "logging, analyzing",
    "author": "Aravind Kumar Vemula",
    "author_email": "30lmas09@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/3a/4fc640a17f8bcfe37c3fd04646128f16002cf06096adfbbfbe59ba246ed4/logityme-0.0.8.tar.gz",
    "platform": null,
    "description": "\n<h1 align=\"center\">LogiTyme</h1>\n<p align=\"center\">A Python handler for <a href=\"https://github.com/lmas3009/LogiTyme\"><i>logityme</i></a>.</p>\n\n[//]: # ([![python compatibility]&#40;https://github.com/lmas3009/LogiTyme/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions/badge.svg&#41;]&#40;https://github.com/lmas3009/LogiTyme/actions/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions.yml&#41;)\n[![python version](https://img.shields.io/badge/Works_With_Python-3.8,%203.9,%203.10,%203.11-orange)](https://github.com/lmas3009/LogiTyme/actions/workflows/Check%20Python%20Package%20Compatiblity%20in%20all%20versions.yml)\n\n---\n\nLogiTyme is a Python package used to track the time spent on each function, custom functions, and the entire Python Program\n\n- Python package repo link: https://pypi.org/project/LogiTyme/\n\n\n# *Installation Process*:\n1. Install LogiTyme via pip:\nTo install the LogiTyme package, use the following pip command\n    ```bash\n    pip install LogiTyme\n    ```\n3. Verifify the Installation:\nAfter installation, you can verify it by importing LogiTyme in a python script\n    ```bash\n    import LogiTyme\n    print(LogiTyme.__version__)\n    ```\n\n\n# *Usage*\n\nSimple example on how to use:\n```bash\nfrom LogiTyme import LogiTyme\n\nlogityme = LogiTyme(env=\"local\",maxTime=5)\n\nlogityme.StartReport()\n\n@logityme.smart_threshold_check(maxTimeLimit=3)\ndef slow_function(n):\n  result = 0\n  for i in range(n):\n    for j in range(n):\n      result += i*j\n      print(result)\n\n  return result\n\n@logityme.smart_threshold_check(maxTimeLimit=2)\ndef slow_function2(n):\n  result = 0\n  for i in range(n):\n    for j in range(n):\n      result += i*j\n      print(result)\n\n  return result\n\nslow_function(20)\nslow_function2(20)\n\nlogityme.LogiFuncStart(name=\"for-loop\", maxLimit=3)\nre = 0\nfor i in range(500):\n  for j in range(500):\n    re += i * j\n    print(re)\nlogityme.LogiFuncEnd()\n\nlogityme.GenerateReport()\n```\n\n**_Resulted Output:_**\n```text\n\nPerformance Analysis\n\n1. Introduction:\n\tThis 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.\n\n2. Methodolgy:\n\tThe 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.\n\n3. Results:\n\t- Started the program at: 2024-07-17 17:38:14.340244\n\t- Ended the program at: 2024-07-17 17:38:19.493889\n\t- Total Execution Time: 5.152 seconds\n\t- As you defined the threshold limit as 5 mins, Since this script took Less then your threshold limit, you are good to go...\n\t- memory consumed: 0.0234MB\n\n4. Functions Results:\n+----------------+---------------+-----------------------------+\n| Function Name  | Time Consumed | Maximum Threshold Limit Set |\n+----------------+---------------+-----------------------------+\n| slow_function  | 0.004 secs    | 180 secs                    |\n| slow_function2 | 0.004 secs    | 120 secs                    |\n| for-loop       | 4.549 secs    | 180 secs                    |\n+----------------+---------------+-----------------------------+\n\n5. inBuilt-functions Time-Consumed Report:\n+----------------------------------+---------------+\n| Function Name                    | Time Consumed |\n+----------------------------------+---------------+\n| <built-in method builtins.print> | 4.556 secs    |\n+----------------------------------+---------------+\n\n6. Environment Suggestions:\n\t- Short tasks (less than 5 minutes):\n\t\t-- GCP (Cloud Functions, Compute Engine, GKE, Cloud Run) or AWS (Lambda, EC2, ECS, Step Function, Glue): \n\t\t\t Both are well-suited for tasks that complete quickly.\n\t\t-- Azure Functions (Consumption Plan, VM, AKS, Container Instances):\n\t\t\t Good choice for short tasks\n\n7. Code Optimization:\n+----------------+---------------+-----------------------------+\n| Function Name  | Time Consumed | Maximum Threshold Limit Set |\n+----------------+---------------+-----------------------------+\n| slow_function  | 0.004 secs    | 180 secs                    |\n| slow_function2 | 0.004 secs    | 120 secs                    |\n| for-loop       | 4.549 secs    | 180 secs                    |\n+----------------+---------------+-----------------------------+\nSince this function \"slow_function\" took 0.004 secs is less then 180 seconds (i.e < 3 mins). The function is quite optimized.\nSince this function \"slow_function2\" took 0.004 secs is less then 120 seconds (i.e < 2 mins). The function is quite optimized. \nSince this function \"for-loop\" took 4.549 secs is less then 180 seconds (i.e < 3 mins). The function is quite optimized.\n\n8. Conclusion:\n\tThe 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.\n```\n\n\n# _Release Version_\n- **```0.0.7 / 0.0.8```**\n  - Introducing maxTime on LogiTyme\n    - **LogiTyme(env=\"local\",maxTime=5)** _used to set the time limt for entire python program. This is for set the threshold limit._\n  - Introducing decorators\n    - **@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._\n  - Introducing maxLimit on LogiFuncStart\n    - **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._\n  \n\n- **```0.0.2 / 0.0.3 / 0.0.4 / 0.0.5 / 0.0.6```**\n  - Launching LogiTyme\n    - Functions Included:\n      - **StartReport:** _used to start the process of logging the time for you python program._\n      - **GenerateReport:**  _used to end the logging process and generate a report based on each function used in the code.\n        Now this will start process the logged data and generate a report based on the time spent in each function used in your code.\n        The generated report will provide insights into the performance if different functions_\n        - env  To run the code in local machine or in cloud machine\n        - env = \"local\" / \"cloud\" \n      - **LogiFuncStart & LogiFuncEnd:** _used to log time for custom code._\n\n\n# *Creator Information*:\n- Created By: Aravind Kumar Vemula\n- Twitter: https://x.com/AravindKumarV09\n- Github: https://github.com/lmas3009\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "LogiTyme is a Python package used to track the time spent on each function, custom functions, and the entire Python Program.",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/lmas3009/LogiTyme"
    },
    "split_keywords": [
        "logging",
        " analyzing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "220012f17def8c1347914f54f227019dc38199d0cb69ec2a1624698c27b2dbad",
                "md5": "4b68628c459d3433b0a0aba57a51e250",
                "sha256": "c1ba48778c0af9f9397d6bbb1890394e650ffe1583d55868a940fd38295985ac"
            },
            "downloads": -1,
            "filename": "LogiTyme-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4b68628c459d3433b0a0aba57a51e250",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8130,
            "upload_time": "2024-07-18T04:42:57",
            "upload_time_iso_8601": "2024-07-18T04:42:57.400052Z",
            "url": "https://files.pythonhosted.org/packages/22/00/12f17def8c1347914f54f227019dc38199d0cb69ec2a1624698c27b2dbad/LogiTyme-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d3a4fc640a17f8bcfe37c3fd04646128f16002cf06096adfbbfbe59ba246ed4",
                "md5": "d4b9c67927400589278e037ac067ff4f",
                "sha256": "fc8cf0c914faab539433d463dc2f989452bc9f74f0548004004c17099ef62316"
            },
            "downloads": -1,
            "filename": "logityme-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d4b9c67927400589278e037ac067ff4f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7329,
            "upload_time": "2024-07-18T04:42:58",
            "upload_time_iso_8601": "2024-07-18T04:42:58.815321Z",
            "url": "https://files.pythonhosted.org/packages/8d/3a/4fc640a17f8bcfe37c3fd04646128f16002cf06096adfbbfbe59ba246ed4/logityme-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-18 04:42:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lmas3009",
    "github_project": "LogiTyme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "terminaltables",
            "specs": [
                [
                    "==",
                    "3.1.10"
                ]
            ]
        }
    ],
    "lcname": "logityme"
}
        
Elapsed time: 0.30739s