Download:
child 12:91034d51100c
parent 10:c104b23c85f0
11:251971044ff2
Anton Shestakov <engored@ya.ru>, Sat, 11 Jan 2014 23:57:14 +0900
More on qmonitor.

1 files changed, 12 insertions(+), 3 deletions(-) [+]
qmonitor/README.md file | annotate | diff | comparison | revisions
--- a/qmonitor/README.md Sat Jan 11 23:41:32 2014 +0900
+++ b/qmonitor/README.md Sat Jan 11 23:57:14 2014 +0900
@@ -63,6 +63,15 @@
qm.check()
-This will check performace (so far just count number of DB queries) and assist
-in making the "managed" block of code as fast as possible. It is also quite
-easy to use in integration tests for finding database-intensive code.
+QMonitor class will hold all related queries and, in general, will be a user
+interface, since it is returned by the qmonitor context manager. The last thing
+in the snippet is a basic query that will generate 4 database queries, which is
+far from optimal. This is an easy case for QMonitor, since it will easily find
+that the block of code generated 3 identical queries.
+
+Such context manager can help checking performace (at least just count number
+of DB queries) and assist in making the "managed" block of code as fast as
+possible. I also found it to be really easy to use in integration tests for
+Tornado without any need to modify actual handlers or monkey-patching anything.
+(It's easier to try yourself, but in case you're wondering it simply works by
+wrapping `self.fetch(url)` in the context manager.)