[banshee] [Hyena.Metrics] Add Metric.PushSample method
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [Hyena.Metrics] Add Metric.PushSample method
- Date: Fri, 12 Feb 2010 21:57:27 +0000 (UTC)
commit adff2eb0596f43889cb9d3884038baf0b221a9c0
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Feb 12 13:55:26 2010 -0800
[Hyena.Metrics] Add Metric.PushSample method
src/Libraries/Hyena/Hyena.Metrics/Metric.cs | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/Libraries/Hyena/Hyena.Metrics/Metric.cs b/src/Libraries/Hyena/Hyena.Metrics/Metric.cs
index 1eb3048..07997cf 100644
--- a/src/Libraries/Hyena/Hyena.Metrics/Metric.cs
+++ b/src/Libraries/Hyena/Hyena.Metrics/Metric.cs
@@ -62,13 +62,27 @@ namespace Hyena.Metrics
{
}
+ public void PushSample (object sampleValue)
+ {
+ try {
+ store.Add (new Sample (this, sampleValue));
+ } catch (Exception e) {
+ Log.Exception ("Error taking sample", e);
+ }
+ }
+
public void TakeSample ()
{
if (sample_func == null) {
- throw new InvalidOperationException ("sampleFunc is null. Are you calling TakeSample on a non-event-driven metric?");
+ Log.Warning ("sampleFunc is null. Are you calling TakeSample on a non-event-driven metric?");
+ return;
}
- store.Add (new Sample (this, sample_func ()));
+ try {
+ store.Add (new Sample (this, sample_func ()));
+ } catch (Exception e) {
+ Log.Exception ("Error taking sample", e);
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]