|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta http-equiv="content-type" content="text/html; charset=windows-1252"> |
| 5 | + <title>ruby-prof</title> |
| 6 | + <link rel="stylesheet" type="text/css" href="assets/styles.css"> |
| 7 | + </head> |
| 8 | + <body> |
| 9 | + <div class="header"><img src="./assets/ruby-prof-logo-white.svg"></div> |
| 10 | + <div class="grid-container"> |
| 11 | + <nav role="navigation"> |
| 12 | + <ul> |
| 13 | + <li><a href="#overview">Overview</a></li> |
| 14 | + <li><a href="#api-documentation">API Documentation</a></li> |
| 15 | + <li><a href="#license"></a><a href="#license">License</a></li> |
| 16 | + <li><a href="#development">Development</a></li> |
| 17 | + </ul> |
| 18 | + </nav> |
| 19 | + <div class="main"> |
| 20 | + <h1>Architecuture<span> </span></h1> |
| 21 | + <p><a href="https://travis-ci.org/ruby-prof/ruby-prof"><img src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master" |
| 22 | + alt="Build Status"></a></p> |
| 23 | + <h2><a id="overview">Overview</a></h2> |
| 24 | + <p>ruby-prof is a profiler for MRI Ruby. Its built as a C extension and |
| 25 | + therefore many times faster than the standard Ruby profiler. The image |
| 26 | + below shows the main classes that make up ruby-prof:</p> |
| 27 | + <p><br> |
| 28 | + </p> |
| 29 | + <img src="assets/class_diagram.png" alt="Class Diagram" title="Class Diagram"> |
| 30 | + <p><br> |
| 31 | + </p> |
| 32 | + The top level class is Profile, which is returned by a profiling run: |
| 33 | + <pre class="ruby"><span class="ruby-identifier">profile = RubyProf.profile do </span><br> .. |
| 34 | + <span style="color: navajowhite;"> end</span></pre> |
| 35 | + <p>A profile owns a hash of threads, and threads in turn own the methods |
| 36 | + called in that thread as well as call trees which record how the |
| 37 | + methods were called.</p> |
| 38 | + <h2><a id="memory">Memory Management</a></h2> |
| 39 | + <p>The master object is the Profile object. Each Profile object is |
| 40 | + responsible for managing the memory of its child objects which are C |
| 41 | + structures. When the Profile object goes out of scope, it recursively |
| 42 | + frees all its objects. In the class diagram, this can bee seen |
| 43 | + by the composition relationships. The owning object is denoted with a |
| 44 | + filled in black diamond. Thus a Profile frees its threads, Threads |
| 45 | + free their Methods, etc.</p> |
| 46 | + <p><br> |
| 47 | + </p> |
| 48 | + <p><br> |
| 49 | + </p> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + </body> |
| 53 | +</html> |
|
0 commit comments