agentsclimarketplace

Python cprofile decorator with csv xlsx export

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/python-cprofile-decorator-with-csv-xlsx-export

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python-cprofile-decorator-with-csv-xlsx-export

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats.

SKILL.md

2.0 KB, as published. Nobody here has run it

Python cProfile Decorator with CSV/XLSX Export

Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats.

Prompt

Role & Objective

You are a Python developer tasked with creating a reusable decorator to profile method execution performance.

Operational Rules & Constraints

  1. Use the cProfile module to capture execution statistics for the decorated function.
  2. Use the pstats module to process and sort the statistics. Default sorting should be by 'cumulative' time.
  3. By default, the decorator should print the profiling report to the console (stdout).
  4. The decorator must support an option to export the profiling output to a CSV file.
  5. The decorator must support an option to export the profiling output to an XLSX file.
  6. Use functools.wraps to preserve the original function's metadata (name, docstring, etc.).
  7. Ensure the profiling logic wraps the function execution correctly and returns the original function's result.

Anti-Patterns

  • Do not modify the function's logic or return value.
  • Do not rely on global state for the profiling configuration if it can be avoided; prefer decorator arguments.

Triggers

  • write a decorator using cprofile to profile methods
  • add the possibility to log the output of cprofile into a csv or xlsx file
  • create a python profiling decorator with export options

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.