addCounter Method

Adds a new Windows performance counter to the set being monitored automatically by the Listener. Manually added counters may be removed using the removeCounter method.

For more information about working with counters, see Supporting Windows Performance Counters.

Syntax
void addCounter(String counterPath);
Parameters
counterPath - [in] Required String, which specifies a valid counter path. The string may be passed as Unicode that contains any printable characters excluding the newline character. For more information about valid counter paths, refer to the documentation for Microsoft Windows® Performance Monitor.
Example
Listener listener = new Listener("sampleApp", "4.0");
listener.addCounter("\\TCP\\Segments Sent/sec");
...
See Also
Listener Class
removeCounter Method