コード例 #1
0
ファイル: bench.py プロジェクト: dhermes/ndb-git
def main():
    utils.tweak_logging()  # Interpret -v and -q flags.
    n = 15  # Much larger and it takes forever.
    for arg in sys.argv[1:]:
        try:
            n = int(arg)
            break
        except Exception:
            pass
    prof = cProfile.Profile()
    prof = prof.runctx('bench(%d)' % n, globals(), locals())
    stats = pstats.Stats(prof)
    stats.strip_dirs()
    stats.sort_stats('time')  # 'time', 'cumulative' or 'calls'
    stats.print_stats(20)  # Arg: how many to print (optional)
コード例 #2
0
ファイル: keybench.py プロジェクト: MapofLife/MOL
def main():
  utils.tweak_logging()  # Interpret -v and -q flags.
  n = 10000
  for arg in sys.argv[1:]:
    try:
      n = int(arg)
      break
    except Exception:
      pass
  prof = cProfile.Profile()
  prof = prof.runctx('bench(%d)' % n, globals(), locals())
  stats = pstats.Stats(prof)
  stats.strip_dirs()
  stats.sort_stats('time')  # 'time', 'cumulative' or 'calls'
  stats.print_stats(20)  # Arg: how many to print (optional)
コード例 #3
0
def main():
  utils.tweak_logging()  # Interpret -v and -q flags.

  tb = testbed.Testbed()
  tb.activate()
  tb.init_datastore_v3_stub()
  tb.init_memcache_stub()

  n = 1000
  for arg in sys.argv[1:]:
    try:
      n = int(arg)
      break
    except Exception:
      pass

  populate(n)

  profiler(bench, n)
コード例 #4
0
def main():
    utils.tweak_logging()  # Interpret -v and -q flags.

    tb = testbed.Testbed()
    tb.activate()
    tb.init_datastore_v3_stub()
    tb.init_memcache_stub()

    n = 1000
    for arg in sys.argv[1:]:
        try:
            n = int(arg)
            break
        except Exception:
            pass

    populate(n)

    profiler(bench, n)
コード例 #5
0
# Startup file for interactive prompt, used by "make python".

from ndb import utils
utils.tweak_logging()

import os

from google.appengine.api import apiproxy_stub_map
from google.appengine.api.blobstore import dict_blob_storage
from google.appengine.api.blobstore import blobstore_stub
from google.appengine.api import datastore_file_stub
from google.appengine.api import memcache
from google.appengine.api.memcache import memcache_stub
from google.appengine.api import taskqueue
from google.appengine.api.taskqueue import taskqueue_stub
from google.appengine.api import urlfetch_stub

from ndb import *

apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
ds_stub = datastore_file_stub.DatastoreFileStub('_', None)
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', ds_stub)
mc_stub = memcache_stub.MemcacheServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('memcache', mc_stub)
tq_stub = taskqueue_stub.TaskQueueServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('taskqueue', tq_stub)
uf_stub = urlfetch_stub.URLFetchServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', uf_stub)
bs_storage = dict_blob_storage.DictBlobStorage()
bs_stub = blobstore_stub.BlobstoreServiceStub(bs_storage)
apiproxy_stub_map.apiproxy.RegisterStub('blobstore', bs_stub)
コード例 #6
0
# Startup file for interactive prompt, used by "make python".

from ndb import utils
utils.tweak_logging()

import os

from google.appengine.api import apiproxy_stub_map
from google.appengine.api.blobstore import dict_blob_storage
from google.appengine.api.blobstore import blobstore_stub
from google.appengine.api import datastore_file_stub
from google.appengine.api import memcache
from google.appengine.api.memcache import memcache_stub
from google.appengine.api import taskqueue
from google.appengine.api.taskqueue import taskqueue_stub
from google.appengine.api import urlfetch_stub

from ndb import *

apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
ds_stub = datastore_file_stub.DatastoreFileStub('_', None)
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', ds_stub)
mc_stub = memcache_stub.MemcacheServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('memcache', mc_stub)
tq_stub = taskqueue_stub.TaskQueueServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('taskqueue', tq_stub)
uf_stub = urlfetch_stub.URLFetchServiceStub()
apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', uf_stub)
bs_storage = dict_blob_storage.DictBlobStorage()
bs_stub = blobstore_stub.BlobstoreServiceStub(bs_storage)
apiproxy_stub_map.apiproxy.RegisterStub('blobstore', bs_stub)