Giter VIP home page Giter VIP logo

kttimming's Introduction

KTTimming

An timer that timming by scope, a copycat of llvm::Timer.

📖Usage

Simply declare a local varibale of KT::Timer, it would print out the timming result in it's scope when running destructor:

void HeavyWork() {
    for (int i = 0; i < 999999; i++) {
        __unused int j = rand() % i;
    }
}

int main(int argc, const char * argv[]) {
    KT::Timer MainTimer("Main", "timming cost in main function scope");
    {
        KT::Timer HeavyWorkTimer("Heavywork", "timming cost in closest scope");
        HeavyWork();
    }
    return 0;
}

and it would output the user/system/wall time:

Name: Heavywork
Des: timming cost in closest scope
UserTime:   0.005935
SystemTime: 0.000024
WallTime:   0.005959

Name: Main
Des: timming cost in main function scope
UserTime:   0.005942
SystemTime: 0.000033
WallTime:   0.005981

kttimming's People

Contributors

kam-to avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.