[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: measuring time to query
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: measuring time to query a user's history |
Date: |
Fri, 01 Dec 2017 18:28:36 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new c8f9b7a measuring time to query a user's history
c8f9b7a is described below
commit c8f9b7aa165b19c9b8c5bb61562d000ff5996311
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Dec 1 18:27:44 2017 +0100
measuring time to query a user's history
---
talerbank/app/tests.py | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 63de569..8baed5a 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -15,6 +15,8 @@
# @author Marcello Stanisci
import json
+import timeit
+import logging
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.conf import settings
@@ -404,3 +406,39 @@ class ParseAmountTestCase(TestCase):
return
# make sure the control doesn't get here
self.assertEqual(True, False)
+
+class MeasureHistory(TestCase):
+
+ def setUp(self):
+ self.user_bankaccount0 = BankAccount(
+ user=User.objects.create_user(username='U0'),
+ amount=Amount(settings.TALER_CURRENCY, 3000))
+ self.user_bankaccount = BankAccount(
+ user=User.objects.create_user(username='U'))
+ self.user_bankaccount.save()
+ self.user_bankaccount0.save()
+
+ self.ntransfers = 1000
+
+ # Make sure logging level is WARNING, otherwise the loop
+ # will overwhelm the console.
+ logging.getLogger().setLevel(logging.WARNING)
+ for i in range(self.ntransfers):
+ wire_transfer(Amount(settings.TALER_CURRENCY, 1),
+ self.user_bankaccount0,
+ self.user_bankaccount,
+ "bulk")
+
+ def test_extract_history(self):
+
+ # Measure the time extract_history() needs to retrieve
+ # ~ntransfers records.
+ timer = timeit.Timer(stmt="extract_history(self.user_bankaccount0)",
+ setup="from talerbank.app.views import
extract_history",
+ globals=locals())
+ total_time = timer.timeit(number=1)
+ logging.getLogger().setLevel(logging.INFO)
+ logging.getLogger().info("%d records needed %.3f secs" \
+ % (self.ntransfers, total_time))
+ allowed_time_per_record = 0.0017
+ self.assertLess(total_time, self.ntransfers*allowed_time_per_record)
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-bank] branch master updated: measuring time to query a user's history,
gnunet <=