diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2007-08-01 21:55:27 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2007-08-01 21:55:27 +0400 |
commit | 9fd98baecca1c4e29653e6cd20b19e554cc9694c (patch) | |
tree | 0c8c11c015bfbeb449ce7f032d2acd4967fb9d8c /mcs/class/System/System.Diagnostics/CounterSample.cs | |
parent | 3fc8429094c14a3a2d6f707f9d587f343e0eb770 (diff) |
2007-08-01 Atsushi Enomoto <atsushi@ximian.com>
* CounterSample.cs : implemented missing 2.0 equality stuff.
* CounterSampleCalculator.cs : static in 2.0.
svn path=/trunk/mcs/; revision=83222
Diffstat (limited to 'mcs/class/System/System.Diagnostics/CounterSample.cs')
-rw-r--r-- | mcs/class/System/System.Diagnostics/CounterSample.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mcs/class/System/System.Diagnostics/CounterSample.cs b/mcs/class/System/System.Diagnostics/CounterSample.cs index 846fd76c610..1757af99466 100644 --- a/mcs/class/System/System.Diagnostics/CounterSample.cs +++ b/mcs/class/System/System.Diagnostics/CounterSample.cs @@ -122,6 +122,50 @@ namespace System.Diagnostics { { return CounterSampleCalculator.ComputeCounterValue (counterSample, nextCounterSample); } + +#if NET_2_0 + public override bool Equals (object obj) + { + if (!(obj is CounterSample)) + return false; + return Equals ((CounterSample) obj); + } + + public bool Equals (CounterSample other) + { + return + rawValue == other.rawValue && + baseValue == other.counterFrequency && + counterFrequency == other.counterFrequency && + systemFrequency == other.systemFrequency && + timeStamp == other.timeStamp && + timeStamp100nSec == other.timeStamp100nSec && + counterTimeStamp == other.counterTimeStamp && + counterType == other.counterType; + } + + public static bool operator == (CounterSample obj1, CounterSample obj2) + { + return obj1.Equals (obj2); + } + + public static bool operator != (CounterSample obj1, CounterSample obj2) + { + return !obj1.Equals (obj2); + } + + public override int GetHashCode () + { + return (int) (rawValue << 28 ^ + (baseValue << 24 ^ + (counterFrequency << 20 ^ + (systemFrequency << 16 ^ + (timeStamp << 8 ^ + (timeStamp100nSec << 4 ^ + (counterTimeStamp ^ + (int) counterType))))))); + } +#endif } } |