Giter VIP home page Giter VIP logo

measurer's Introduction

Easy measuring a function

Measure run time of a function.

関数の実行時間を簡単に測定するためのモジュール。
Measurerインスタンスを生成し、measureメソッドに測定したい関数を渡すだけで、指定回数実行した場合の総実行時間と一回当たりの平均実行時間を画面に出力する。
また、返り値としてカンマ区切りの文字列関数名,総実行時間,平均実行時間を返す。

How to use

from measurer import Measurer

# This function is you want to measure.
def function():
  # Some processes..
  return

measurer = Measurer()
result = measurer.measure(function)
# [Completed] function()
#     Total  : xxx[sec]
#     Average: yyy[sec]
print(result)
# function,xxx,yyy

Methods

measurer.Measurer(self, repeat=100, color=True)
  • Arguments
    • repeat (int): The number of executions of measured a function. This number must be larger than 1.
    • color (boolean): Coloring log messge.
measurer.Measurer.measure(self, function, *args)
  • Arguments

    • function (function): It is a function you want to measure.
    • args (tuple): This argument is passed to measured a funstion.
  • Return

    • Message of result of measuring a function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.