PerfCounter.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #include "CommonCorePch.h"
  6. #include "PerfCounterImpl.cpp"
  7. #ifdef PERF_COUNTERS
  8. namespace PerfCounter
  9. {
  10. Counter& Counter::operator+=(size_t value)
  11. {
  12. Assert(count);
  13. ::InterlockedExchangeAdd(count, (DWORD)value);
  14. return *this;
  15. }
  16. Counter& Counter::operator-=(size_t value)
  17. {
  18. Assert(count);
  19. ::InterlockedExchangeSubtract(count, (DWORD)value);
  20. return *this;
  21. }
  22. Counter& Counter::operator++()
  23. {
  24. Assert(count);
  25. ::InterlockedIncrement(count);
  26. return *this;
  27. }
  28. Counter& Counter::operator--()
  29. {
  30. Assert(count);
  31. ::InterlockedDecrement(count);
  32. return *this;
  33. }
  34. }
  35. #endif