------------------------------------------------------------
revno: 360
committer: Michal Hruby <michal....@gmail.com>
branch nick: bluebird
timestamp: Sat 2011-12-31 20:35:28 +0100
message:
  Add real-world query samples
added:
  tools/development/query_sets/synapse-unlimited.txt
  tools/development/query_sets/synapse.txt
modified:
  tools/development/query_timings.py


--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to 
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== added file 'tools/development/query_sets/synapse-unlimited.txt'
--- tools/development/query_sets/synapse-unlimited.txt	1970-01-01 00:00:00 +0000
+++ tools/development/query_sets/synapse-unlimited.txt	2011-12-31 19:35:28 +0000
@@ -0,0 +1,9 @@
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.SOFTWARE), Subject.new_for_values(interpretation="!"+Interpretation.FOLDER)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.SOFTWARE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.AUDIO)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.VIDEO)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.IMAGE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.DOCUMENT)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.WEBSITE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.WEBSITE)])], StorageState.Any, 96, ResultType.MostRecentOrigin
+TimeRange.until_now(), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.WEBSITE),Subject.new_for_values(interpretation="!"+Interpretation.SOFTWARE),Subject.new_for_values(interpretation="!"+Interpretation.AUDIO),Subject.new_for_values(interpretation="!"+Interpretation.VIDEO),Subject.new_for_values(interpretation="!"+Interpretation.IMAGE),Subject.new_for_values(interpretation="!"+Interpretation.DOCUMENT)])], StorageState.Any, 96, ResultType.MostRecentSubjects

=== added file 'tools/development/query_sets/synapse.txt'
--- tools/development/query_sets/synapse.txt	1970-01-01 00:00:00 +0000
+++ tools/development/query_sets/synapse.txt	2011-12-31 19:35:28 +0000
@@ -0,0 +1,9 @@
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.SOFTWARE), Subject.new_for_values(interpretation="!"+Interpretation.FOLDER)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.SOFTWARE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.AUDIO)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.VIDEO)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.IMAGE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.DOCUMENT)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation=Interpretation.WEBSITE)])], StorageState.Any, 96, ResultType.MostRecentSubjects
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.WEBSITE)])], StorageState.Any, 96, ResultType.MostRecentOrigin
+TimeRange.from_timestamp(time.time()*1000-604800000*24), [Event.new_for_values(subjects=[Subject.new_for_values(interpretation="!"+Interpretation.WEBSITE),Subject.new_for_values(interpretation="!"+Interpretation.SOFTWARE),Subject.new_for_values(interpretation="!"+Interpretation.AUDIO),Subject.new_for_values(interpretation="!"+Interpretation.VIDEO),Subject.new_for_values(interpretation="!"+Interpretation.IMAGE),Subject.new_for_values(interpretation="!"+Interpretation.DOCUMENT)])], StorageState.Any, 96, ResultType.MostRecentSubjects

=== modified file 'tools/development/query_timings.py'
--- tools/development/query_timings.py	2011-12-31 00:22:58 +0000
+++ tools/development/query_timings.py	2011-12-31 19:35:28 +0000
@@ -32,7 +32,7 @@
 from collections import defaultdict
 
 from zeitgeist.datamodel import TimeRange, StorageState, ResultType
-from zeitgeist.datamodel import Event
+from zeitgeist.datamodel import Event, Subject, Interpretation, Manifestation
 import benchmark as engine
 
 from cairoplot import vertical_bar_plot
@@ -82,6 +82,7 @@
     parser.add_option("--plot", dest="plot_files", metavar="DATA_FILE",
         action="append", type="str")
     parser.add_option("--type", dest="type", help="type of plot")
+    parser.add_option("--count", dest="count", help="number of execution of each query", type="int")
     (options, args) = parser.parse_args()
     assert not args
     return options
@@ -153,6 +154,7 @@
             existing_data = json.load(open(options.output))
         else:
             existing_data = {}
+        num_queries = 50 if not options.count else options.count
         logging.basicConfig(level=logging.DEBUG)
         for query in get_query_set(options.queryset):
             args = eval(query)
@@ -161,7 +163,7 @@
             handler = QueryPlanHandler()
             logging.getLogger("").addHandler(handler)
             results = {}
-            for i in xrange (50):
+            for i in xrange (num_queries):
                 t1 = time.time()
                 temp = engine.find_events(*args)
                 temp["overall"] = time.time() - t1
@@ -177,7 +179,7 @@
             
             for key in temp.keys():
                 if key != "events":
-                    results[key] = results[key]/50
+                    results[key] = results[key]/num_queries
             
             print (results.keys())
             

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to