PHPackages                             rah/rah\_runtime - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. rah/rah\_runtime

ActiveTextpattern-plugin[Debugging &amp; Profiling](/categories/debugging)

rah/rah\_runtime
================

Diagnose Textpattern CMS template execution times

10PHP

Since Sep 25Pushed 12y ago1 watchersCompare

[ Source](https://github.com/gocom/rah_runtime)[ Packagist](https://packagist.org/packages/rah/rah_runtime)[ RSS](/packages/rah-rah-runtime/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

rah\_runtime
============

[](#rah_runtime)

[Homepage](http://rahforum.biz/plugins/rah_runtime) | [Packagist](https://packagist.org/packages/rah/rah_runtime) | [Twitter](https://twitter.com/gocom) | [GitHub](https://github.com/gocom/rah_runtime) | [Support forum](http://forum.textpattern.com/viewtopic.php?id=33914) | [Donate](http://rahforum.biz/donate/rah_runtime)

Rah\_runtime returns runtimes from point A to B in microseconds. The plugin can be used to diagnose runtimes of specific blocks of Textpattern’s markup code.

Basics
------

[](#basics)

```

    ...contained statements...

```

The plugin introduces a new Textpattern tag, ``. The tag calculates execution runtimes for Textpattern template markuThe runtimes can be printed to the page template and are added to a [tag trace](http://textpattern.net/wiki/index.php?title=Tag_trace).

The rah\_runtime tag can be used both as a container and as a self-closing single tag. When the tag is used as a container, it calculates a runtime of the wrapped code. When used as a self-closing single tag, it calculates a runtime from the first tag instance to the second.

Attributes
----------

[](#attributes)

`` tag’s attributes are as follows.

**return**
If set to `1`, the tag outputs the runtime to the page template. If `0` the runtime is only added and visible in the page’s [tag trace](http://textpattern.net/wiki/index.php?title=Tag_trace) when the site is in debugging mode. By default `return` is `0`, and the runtimes are only added to the tag trace.
Example: `return="1"` Default: `"0"`

**format**
Return formatted version of the time. When used, resulting value (float) is presented as a fixed decimal number. By default the option is used (`1`).
Example: `format="0"` Default: `"1"`

**index**
With this attribute you can nest several tag pairs and count several independent runtimes. The `index` attribute only applies when `` is used as a self-closing single tag.
Example: `index="articles"` Default: `"default"`

**persistent**
If set to `1`, the runtime is kept alive after returning. Normally the runtime pair is destroyed after using it, but with `persistent` the initial runtime is kept and still usable. The attribute is useful if you want to calculate multiple runtimes from same single starting point. The `persistent` attribute only applies when `` is used as a self-closing single tag.
Example: `persistent="1"` Default: `"0"`

Examples
--------

[](#examples)

### Using as a container

[](#using-as-a-container)

As a container, `rah_runtime` calculates a runtime for the wrapped content.

```

```

The above will return the contained statement’s results, as it would normally without the rah\_runtime, and the runtime of the contained statement is added to the page’s [tag trace](http://textpattern.net/wiki/index.php?title=Tag_trace). The tag trace should display a line similar to this:

```
[rah_runtime (default): 0.000010013580322]
```

### Using as a single tag

[](#using-as-a-single-tag)

When the rah\_runtime tag is used as a single, self-closing tag, the runtime is calculated from a `` tag instance to the next. Essentially the runtime is for the markup and code between two `` tags.

```

```

The above will return all the markup normally, like there weren’t any traces of rah\_runtime, and the runtime is added to the page’s tag trace as a line similar to this:

```
[rah_runtime (default): 0.000010013580322]
```

### Returning runtimes to the page

[](#returning-runtimes-to-the-page)

Normally the resulting runtimes are added to the [tag trace](http://textpattern.net/wiki/index.php?title=Tag_trace) and are not visible in the normal page content. That is unless `return` attribute is set to `1`.

```

Runtime:
```

The runtime is added to the tag trace and the above will return:

```
Runtime: 0.00021401458032
```

### Using multiple nested tag pairs

[](#using-multiple-nested-tag-pairs)

The rah\_runtime tag’s `index` attribute can be used to nest and mix multiple `` tags and runtime pairs together. This will allow calculating simultaneous runtimes that overlap each others.

```

Time1:
Time2:
```

The above will return two runtimes:

```
Time1: 0.000081
Time2: 0.000184
```

The *time2* contains the runtime of *time1* and more.

### Using persistent runtimes

[](#using-persistent-runtimes)

Persistent runtimes are useful when several runtimes are to be calculated from a same starting point.

```

```

```

```

```

```

```

```

```

```

```

```

```

```

```

```

Note that every one of the rah\_runtime tags (except for the last) has `persistent` attribute set to `1`. If the tag doesn’t have it, then the runtime pair is destroyed after returning it. To finally destroy the runtime, set persistent to `"0"` (zero) or leave it undefined.

Changelog
---------

[](#changelog)

### Version 0.5.0 – upcoming

[](#version-050--upcoming)

- Updated: Help file.

### Version 0.4 – 2012/07/12

[](#version-04--20120712)

- Added: `return` attribute.
- Added: Now the runtimes are added to the tag trace.
- Added: Container tag mode support.
- Changed: By default runtimes are only visible in a tag trace. Set `return` attribute to `1` (`return="1"`) output runtimes to the page template.
- Changed: Default `index` to `default`. This is to avoid potential type juggling side-effects.

### Version 0.3 – 2011/08/19

[](#version-03--20110819)

- Added: a new attribute `persistent`. Disables destroying of used runtime pairs.
- Changed: Now stores the runtimes in a static variable instead of a global.

### Version 0.2 – 2010/06/18

[](#version-02--20100618)

- Fixed: now returns as float (compatible with pre-PHP5). [Thank you for reporting, Andreas](http://forum.textpattern.com/viewtopic.php?pid=230410#p230410).

### Version 0.1 – 2010/06/15

[](#version-01--20100615)

- Initial release.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a34b4e1b662cd2c926e8e89a76f93df266b199fe61508d38026cb952f28e59e?d=identicon)[rah](/maintainers/rah)

### Embed Badge

![Health badge](/badges/rah-rah-runtime/health.svg)

```
[![Health](https://phpackages.com/badges/rah-rah-runtime/health.svg)](https://phpackages.com/packages/rah-rah-runtime)
```

###  Alternatives

[fjogeleit/prometheus-messenger-middleware

Prometheus Middleware for the Symfony Messenger Component

2255.2k](/packages/fjogeleit-prometheus-messenger-middleware)[spatie/craft-ray

Easily debug CraftCMS projects

1638.4k](/packages/spatie-craft-ray)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
