1# Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5 6import common 7from autotest_lib.client.common_lib.cros.graphite import autotest_stats 8from autotest_lib.site_utils.lib import infra 9from autotest_lib.site_utils.stats import registry 10 11 12@registry.loop_stat('devserver') 13def num_devserver_processes(server): 14 """ 15 Submits a stat for the number of devserver processes that are on the server. 16 17 @param server: The AFE server. 18 """ 19 out = infra.execute_command(server, 'ps -C devserver.py| wc -l') 20 stat = autotest_stats.Gauge(server, bare=True) 21 # ps prints out a header for the columns also, so we subtract one to report 22 # about only the data. 23 stat.send('num_devserver_processes', int(out.strip())-1) 24