diff options
author | Gabriel Burt <gabriel.burt@gmail.com> | 2010-04-08 17:08:12 -0700 |
---|---|---|
committer | Gabriel Burt <gabriel.burt@gmail.com> | 2010-04-08 17:09:15 -0700 |
commit | e17b7eaa94c2ac42e0041cb71b46b4dd1e864dd3 (patch) | |
tree | 23f2e401daccc160b086e77816b2a574e7ec2974 /extras | |
parent | b92bc2a4092fcb4b89a5fd832eb55359467d435f (diff) |
[extras/metrics] Add --timeline option
Prints out data in a form my commit-chart script can process, showing
when users started Banshee.
Diffstat (limited to 'extras')
-rw-r--r-- | 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 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}", + "<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 +} |