Ns stats
Man page: http://aolserver.com/docs/tcl/ns_stats.html
NAME
ns_stats - Return command stats information (AOLserver 3.x only, defunct in 4.0+)
SYNOPSIS
ns_stats ?option? ?pattern?
DESCRIPTION
This command returns proc call stats for procs which match the glob pattern. Results are sorted based on option which can be one of the following:
- -count: results are sorted by count in descending order (default)
- -name: results are sorted by proc name in ascending order
In order to instruct AOLserver to keep these stats, you must define two settings in your nsd.tcl, in section ns/server/${server_name}/tcl:
ns_section ns/server/${server_name}/tcl ns_param statlevel x ns_param statmaxbuf y
Stats will be collected if statlevel is greater than 0. It gets passed to Tcl_CreateTrace() like so:
Tcl_CreateTrace(interp, nsconf.tcl.statlevel, StatsTrace, NULL);
If statsmaxbuf is less than or equal to zero, there will be no stats buffer and the global table will be updated directly, according to the comment:
236 /* 237 * If buffering is not enabled, update the global table directly 238 * (this could be a source of lock contention). Otherwise, update 239 * this thread's table, flushing if the buffer limit is exceeded. 240 */
Otherwise, statmaxbuf specifies the number of entries in the stats buffer hash table.
This is all documented from AOLserver 3.4.2, nsd/tclstats.c.
EXAMPLES
Here is a sample ns_stats.adp to use to display the output of ns_stats:
<xmp> <% ns_adp_puts [format "%-60s %s" command {times invoked}] ns_adp_puts "[string repeat = 60] [string repeat = 13]" foreach {key value} [ns_stats] { ns_adp_puts [format "%-60s %lu" $key $value] } %> </xmp>
SEE ALSO