From e17b7eaa94c2ac42e0041cb71b46b4dd1e864dd3 Mon Sep 17 00:00:00 2001 From: Gabriel Burt Date: Thu, 8 Apr 2010 17:08:12 -0700 Subject: [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 file changed, 21 insertions(+), 5 deletions(-) (limited to 'extras') diff --git a/extras/metrics/Main.cs b/extras/metrics/Main.cs index b6edb41f0..3734f5d85 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}", + "", 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 +} -- cgit v1.2.3