Giter Site home page Giter Site logo

qprof's Introduction

qprof

q code profiler

Contains routines to profile line-level statement execution counts and CPU consumption, distinguishing between execution time consumed within the function and within called functions. Functions to be profiled can be specified explicitly or by referencing a parent namespace (in which case all functions in all namespaces below it are examined).

Profiling temporarily modifies a function by adding instrumentation logic to it. A copy of the original function is first saved, and is restored when profiling is removed. Note that if a profiled function is modified, changes to it are lost when profiling is removed.

For each profiled line, the following data is collected:

  • function name
  • line number
  • line display
  • line execution count
  • total time consumed on the line (including subcalls), in nanoseconds
  • time consumed on the line itself, in nanoseconds

The profiler defines a line to be the shortest sequence of one or more source code lines having no active nesting of parentheses, brackets, or braces (other than the outer braces that define the scope of the function itself). The line must end in a semicolon or be the last line of a function.

Profiling is efficient and is suitable for instrumenting entire workspaces of a running application.

Note that attribution of subcall time may not be correct in a profiled function that signals an event to a higher level.

Usage

Name and Syntax Description
.prof.prof[names] Profiles the specified functions, or all functions in the specified namespaces. If the argument is `, all functions in all non-system namespaces are profiled
.prof.unprof[names] Unprofiles the specified functions, or all functions in the specified namespaces for which profiling is enabled. Collected usage information is discarded. If the argument is `, all profiled functions in all non-system namespaces are unprofiled
.prof.report[names] Produces a report of collected profile information for the specified functions, or all functions in the specified namespaces for which profiling is enabled. If the argument is `, all profiled functions in all non-system namespaces are included in the report. Execution times are reported in milliseconds. Only lines executed are included. The report is ordered by decreasing own line execution time
.prof.data[names] Returns the raw data representing the collected profile information for the specified functions, or all functions in the specified namespaces for which profiling is enabled. If the argument is `, all profiled functions in all non-system namespaces are included in the result. Only lines executed are included. The result is ordered alphabetically by function name and then by line number
.prof.reset[names] Resets the profile statistics for all profiled functions, discarding previous results. The state of profiled functions is unaltered

The variable .prof.LL can be adjusted to change the maximum length of the source line included in the collected data, as reflected by .prof.report and .prof.data.

Changes

  • The profiler now shows the percentage of time consumed on each line relative to all lines.
  • The profiler report is now ordered by decreasing own line execution time.

Author

Leslie Goldsmith, First Derivatives

qprof's People

Contributors

lesliegoldsmith avatar

Watchers

James Cloos 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.