ConfigurationPerformanceCounters.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service_WindowsAzure
  17. * @subpackage Diagnostics
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
  24. */
  25. require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
  26. /**
  27. * @see Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
  28. */
  29. require_once 'Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Service_WindowsAzure
  33. * @subpackage Diagnostics
  34. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. *
  37. * @property int BufferQuotaInMB Buffer quota in MB
  38. * @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
  39. * @property array Subscriptions Subscriptions
  40. */
  41. class Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
  42. extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
  43. {
  44. /**
  45. * Constructor
  46. *
  47. * @param int $bufferQuotaInMB Buffer quota in MB
  48. * @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
  49. */
  50. public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0)
  51. {
  52. $this->_data = array(
  53. 'bufferquotainmb' => $bufferQuotaInMB,
  54. 'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
  55. 'subscriptions' => array()
  56. );
  57. }
  58. /**
  59. * Add subscription
  60. *
  61. * @param string $counterSpecifier Counter specifier
  62. * @param int $sampleRateInSeconds Sample rate in seconds
  63. */
  64. public function addSubscription($counterSpecifier, $sampleRateInSeconds = 1)
  65. {
  66. $this->_data['subscriptions'][$counterSpecifier] = new Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription($counterSpecifier, $sampleRateInSeconds);
  67. }
  68. /**
  69. * Remove subscription
  70. *
  71. * @param string $counterSpecifier Counter specifier
  72. */
  73. public function removeSubscription($counterSpecifier)
  74. {
  75. if (isset($this->_data['subscriptions'][$counterSpecifier])) {
  76. unset($this->_data['subscriptions'][$counterSpecifier]);
  77. }
  78. }
  79. }