1 /* 2 * Copyright (c) 2010, Sangoma Technologies 3 * Moises Silva <moy@sangoma.com> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * * Neither the name of the original author; nor the names of any contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 26 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 * 35 * Contributors: 36 * David Yat Sin <dyatsin@sangoma.com> 37 * 38 */ 39 40 /*! \brief opaque cpu stats structure */ 41 struct ftdm_cpu_monitor_stats; 42 43 /*! 44 * \brief create a new cpu monitor 45 * \return profile timer structure previously created with new_profile_timer, NULL on error 46 */ 47 FT_DECLARE(struct ftdm_cpu_monitor_stats*) ftdm_new_cpu_monitor(void); 48 49 /*! 50 * \brief Deletes cpu_monitor 51 */ 52 FT_DECLARE(void) ftdm_delete_cpu_monitor(struct ftdm_cpu_monitor_stats *p); 53 54 /*! 55 * \brief provides the percentage of idle system time 56 * \param p cpu_stats structure previously created with ftdm_new_cpu_monitor 57 * \param pointer to store the percentage of idle time 58 * \return -1 on error 0 for success 59 */ 60 FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time (struct ftdm_cpu_monitor_stats *p, double *idle_percentage); 61 62 63 64 65 66 /* For Emacs: 67 * Local Variables: 68 * mode:c 69 * indent-tabs-mode:t 70 * tab-width:4 71 * c-basic-offset:4 72 * End: 73 * For VIM: 74 * vim:set softtabstop=4 shiftwidth=4 tabstop=4: 75 */