--- a/nashorn/samples/counters.js Wed May 07 14:07:19 2014 +0530
+++ b/nashorn/samples/counters.js Wed May 07 20:20:58 2014 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,7 +33,11 @@
* This file can be run along with any script you want to run
* to print aggregate stat counters from nashorn.
*
- * Usage: jjs <your-file.js> counters.js
+ * Usage: jjs -J-Dnashorn.debug <your-file.js> counters.js
*/
-Debug.dumpCounters();
+if (java.lang.System.getProperty("nashorn.debug") == null) {
+ print("Usage: jjs -J-Dnashorn.debug <your-file.js> counters.js");
+} else {
+ Debug.dumpCounters();
+}