     unless cname?
       console.error "No main class provided and no Main-Class found in #{argv.jar}"
 
+  run = -> jvm.run_class rs, cname, java_cmd_args, null, argv.compile
+
   if argv.profile?
-    run_profiled rs, cname, java_cmd_args, argv.hot
+    run_profiled run, rs, cname, argv.hot
+  else if argv['count-logs']
+    count = 0
+    stub console, 'log', (-> ++count), run
+    console.log "console.log() was called a total of #{count} times."
+  else if argv['skip-logs']? # avoid generating unnecessary log data
+    count = parseInt argv['skip-logs'], 10
+    old_fn = console.log
+    stub console, 'log', (-> if --count == 0 then console.log = old_fn), run
   else
-    jvm.run_class rs, cname, java_cmd_args, null, argv.compile
+    run()


"use strict"

run_profiled = (rs, cname, java_cmd_args, hot=false) ->
  if hot
    jvm.run_class rs, cname, java_cmd_args
  timings = {}
  call_counts = {}
  profiled_fn = (old_fn) -> ->

    call_counts[method_name] ?= 0

    start = (new Date).getTime()
    old_fn.apply this, arguments
    end = (new Date).getTime()

    timings[hash] += end - start
