https://github.com/sunng87/timing
clojure syntax sugars for perf4j
https://github.com/sunng87/timing
Last synced: 8 months ago
JSON representation
clojure syntax sugars for perf4j
- Host: GitHub
- URL: https://github.com/sunng87/timing
- Owner: sunng87
- Created: 2012-06-30T08:14:47.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-03-23T06:48:26.000Z (almost 11 years ago)
- Last Synced: 2025-05-07T12:13:09.014Z (8 months ago)
- Language: Clojure
- Homepage:
- Size: 114 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# timing
Timing is a simple library to log call time using perf4j.
## Usage
```
[timing "0.1.2"]
```
### timed
Just wrap forms you want to calculate call time:
```clojure
(timed :tag
(look-up-db ...)
(assemble-data ...))
```
Note that you have to provide a `tag` to identify these forms in
timing log.
Timing will select a logging provider automatically by looking up your
classpath (slf4j, log4j and stderr). Timing doesn't depend on any
logging provider at compile time.
### timed-fn
Convert a predefined function to a timed one.
```clojure
(defn count-how-many-people-on-the-earth [req]
)
(defroute my-website
(GET "/count" (timed-fn count-how-many-people-on-the-earth)))
```
### defn-timed
Define a function who is born to be timed.
```clojure
(defn-timed count-how-many-ants-on-the-earth [req]
)
```
### wrap-timed
There's also a built-in ring middleware to log call time for every
request. `wrap-timed` uses uri as timing tags.
```clojure
(wrap-timed handler)
```
## License
Copyright © 2012 [Sun Ning](http://github.com/sunng87)
Distributed under the Eclipse Public License, the same as Clojure.