[banshee] [extras/metrics] Add --timeline option
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [extras/metrics] Add --timeline option
- Date: Fri, 9 Apr 2010 00:09:15 +0000 (UTC)
commit e17b7eaa94c2ac42e0041cb71b46b4dd1e864dd3
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Apr 8 17:08:12 2010 -0700
[extras/metrics] Add --timeline option
Prints out data in a form my commit-chart script can process, showing
when users started Banshee.
extras/metrics/Main.cs | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/extras/metrics/Main.cs b/extras/metrics/Main.cs
index b6edb41..3734f5d 100644
--- a/extras/metrics/Main.cs
+++ b/extras/metrics/Main.cs
@@ -38,14 +38,30 @@ namespace metrics
public static void Main (string [] args)
{
try {
- using (var db = new Database (db_path)) {
- db.Import ();
- new MetaMetrics (db);
- }
+ using (var db = new Database (db_path)) {
+ if (args != null && args.Length > 0 && args[0] == "--timeline") {
+ var metric = db.GetMetric ("Banshee/StartedAt");
+ var usage_samples = new SampleModel (String.Format ("WHERE MetricId = {0}", metric.Id), db, "1");
+ usage_samples.Reload ();
+
+ for (long i = 0; i < usage_samples.Cache.Count; i++) {
+ var sample = usage_samples.Cache.GetValue (i);
+ Console.WriteLine (
+ "{1} {0} {2} {0} {3} {0} {4}",
+ "<TUFTE>", DateTimeUtil.FromDateTime (sample.Stamp), sample.UserId, sample.CacheEntryId, sample.CacheEntryId
+ );
+ }
+
+ return;
+ }
+
+ db.Import ();
+ new MetaMetrics (db);
+ }
} catch (Exception e) {
Console.WriteLine ("Going down, got exception {0}", e);
throw;
}
}
}
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]