Skip to content

Instantly share code, notes, and snippets.

View zoka's full-sized avatar

Zoran Tomičić zoka

  • Microtrol Pty Ltd
  • Sydney
View GitHub Profile
@zoka
zoka / SampleRun.txt
Created March 27, 2012 01:02
lein-webrepl
$ lein2 webrepl
Compiling noir.server
Compilation succeeded.
[ringMon server] starting with: {:local-repl true, :lein-webrepl {:main noir.server}}
2012-03-27 11:57:59.946:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2012-03-27 11:57:59.947:INFO::jetty-6.1.25
2012-03-27 11:57:59.961:INFO::Started SocketConnector@0.0.0.0:8888
; Use this 2 liner to change your chat nick
(use 'ringmon.api)
(set-nick "your-new-nick") ; just paste it into nREPL input window,
; adjust the nick and press 'Submit' button.
@zoka
zoka / api.clj
Created March 18, 2012 10:46
ringmon.api
(ns ringmon.api
(:require
[ringmon.nrepl :as repl]
[ringmon.monitor :as mon]))
"User nREPL scripts should call only ringMon functions from this namespace
to insure backwards compatibility"
(defn set-nick
"Change your chat nick. Return the old one if succesful, nil otherwise."
(ns noirmon.server
(:require [noir.server :as server]
[noirmon.models :as models]
[ringmon.monitor :as monitor]))
(server/load-views "src/noirmon/views/")
(defn -main [& m]
(let [mode (keyword (or (first m) :dev))
port (Integer. (get (System/getenv) "PORT" "8080"))]
@zoka
zoka / penumbra.diff
Created July 24, 2011 06:20
Penumbra patch
diff --git a/src/penumbra/opengl/texture.clj b/src/penumbra/opengl/texture.clj
index c606d06..f45568c 100644
--- a/src/penumbra/opengl/texture.clj
+++ b/src/penumbra/opengl/texture.clj
@@ -13,6 +13,10 @@
(:use [penumbra data])
(:import [org.lwjgl BufferUtils])
(:import (java.io File))
+ (:import (java.nio DoubleBuffer))
+ (:import (java.nio FloatBuffer))
;;
(ns clojfix.simple)
(use 'gloss.core 'gloss.io)
(import
[java.nio
ByteBuffer])
;
ZokaMac:node Zoka$ ./node ../sample/timer_test.js 1000
v8 delta: 100 msec expected: 100 ms, v8_error: 0 ms
v8 delta: 1000 msec expected: 1000 ms, v8_error: 0 ms
ZokaMac:node Zoka$ ./node ../sample/timer_test.js 10000
v8 delta: 98 msec expected: 100 ms, v8_error: 2 ms
v8 delta: 998 msec expected: 1000 ms, v8_error: 2 ms
ZokaMac:node Zoka$ ./node ../sample/timer_test.js 100000
v8 delta: 85 msec expected: 100 ms, v8_error: 15 ms
diff --git a/src/node.cc b/src/node.cc
index 452c111..32911e2 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1062,6 +1062,53 @@ static Handle<Value> CheckBreak(const Arguments& args) {
return Undefined();
}
+ // monotonic time stamp recorded when Node app was started
+static double startup_time;
diff --git a/src/node.cc b/src/node.cc
index 452c111..9395814 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1062,6 +1062,47 @@ static Handle<Value> CheckBreak(const Arguments& args) {
return Undefined();
}
+ // monotonic time stamp recorded when Node app was started
+static double startup_time;
Consecutive get_monotonic_time statistics
for 1000000 invocations:
282 nsec ... 6 times
284 nsec ... 5049 times
285 nsec ... 67767 times
286 nsec ... 7659 times
288 nsec ... 481497 times
289 nsec ... 16496 times
290 nsec ... 21789 times
291 nsec ... 308581 times