Code Monkey home page Code Monkey logo

plog's Introduction

Performance Logging

This application provides different kinds of statistics about performance in erlang enviroment.

There are diffrerent types of counters:

  • delta -- time samples (deltas) of various operations
  • magnitude
  • size
  • value
  • count -- number of items
  • combo -- size and timing samples (size + delta)
  • combo_count -- number of items and timing samples (count + delta)

Usage example

Consider a situation when you want to get execution time of some function -- let it be json to xml convertation. With plog you could simply write:

Xml = plog:delta(hot_part, json_to_xml, fun () ->
        json_to_xml_converter:convert(Json)
    end).

Now you should turn plog application (e.g. application:start(plog)) and enable category hot_part for activating logging: application:set_env(plog, hot_part, true).

That is all.

Now you could watch the statistics: attach to the node and execute plog:print() or plog:print(delta) to print only delta-statistic. The output would be looks like:

    json_to_xml                                     990epm,20ms@95%,20ms@98%
       ms   eps epm
        1     3 169  [616  878  792  779 |3969814] 300avg
        3     5 308 [1183 1435 1499 1461 |6294807] 300avg
        5     4 220  [792 1063 1157 1142 |4573967] 300avg
       10     4 212  [726 1041 1176 1269 |4850060] 300avg
       20     1  74  [259  357  411  412 |1853697] 300avg
       30     0   6   [21   24   51   35  |214992] 300avg
       50     0   1    [3    1    5    2   |46119] 300avg
       75     0   0    [0    1    2    0   |17593] 300avg
      100     0   0    [0    0    4    0    |8161] 300avg
      200     0   0    [0    0    3    0     |926] 300avg
      300     0   0    [0    0    0    0      |70] 300avg
      500     0   0    [0    0    0    0      |53] 300avg
      750     0   0    [0    0    0    0      |10] 300avg
    total    16 990

It is mean that in the last minute it was about 990 event in total. 169 events per minute took <= 1 ms to execute, 308 events took from 1 to 3 ms to execute and so on. You could also see that 95% (and 98% in particular this case too) of all events took less than 20ms.

Please refer to src/plog.erl to obtain more information.

plog's People

Contributors

alvelcom avatar uprial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.