benchmark_api.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * $Id: benchmark_api.h 944 2007-04-11 12:43:49Z bastian $
  3. *
  4. * Benchmarking module for Kamailio
  5. *
  6. * Copyright (C) 2007 Collax GmbH
  7. * (Bastian Friedrich <[email protected]>)
  8. * Copyright (C) 2007 Voice Sistem SRL
  9. *
  10. * This file is part of Kamailio, a free SIP server.
  11. *
  12. * Kamailio is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version
  16. *
  17. * Kamailio is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  25. *
  26. */
  27. /*! \file
  28. * \brief Benchmark :: API functions
  29. *
  30. * \ingroup benchmark
  31. * - Module: benchmark
  32. */
  33. #ifndef BENCHMARK_API_H
  34. #define BENCHMARK_API_H
  35. #include "../../sr_module.h"
  36. typedef int (*bm_register_timer_f)(char *tname, int mode, unsigned int *id);
  37. typedef int (*bm_start_timer_f)(unsigned int id);
  38. typedef int (*bm_log_timer_f)(unsigned int id);
  39. struct bm_binds {
  40. bm_register_timer_f bm_register;
  41. bm_start_timer_f bm_start;
  42. bm_log_timer_f bm_log;
  43. };
  44. typedef int(*load_bm_f)(struct bm_binds *bmb);
  45. int load_bm(struct bm_binds *bmb);
  46. static inline int load_bm_api( struct bm_binds *bmb )
  47. {
  48. load_bm_f load_bm;
  49. /* import the benchmark auto-loading function */
  50. if ( !(load_bm=(load_bm_f)find_export("load_bm", 0, 0)))
  51. {
  52. LM_ERR("can't import load_bm\n");
  53. return -1;
  54. }
  55. /* let the auto-loading function load all benchmarking stuff */
  56. if (load_bm( bmb )==-1)
  57. {
  58. LM_ERR("load_bm failed\n");
  59. return -1;
  60. }
  61. return 0;
  62. }
  63. #endif /* BENCHMARK_API_H */