예제 #1
0
 def repo_impl_timers(self):
     timers = []
     with pass_on_exc(ImportError):
         from forgegit.model.git_repo import GitImplementation
         timers.append(
             Timer('git_tool.{method_name}', GitImplementation, '*'))
     with pass_on_exc(ImportError):
         from forgesvn.model.svn import SVNImplementation
         timers.append(
             Timer('svn_tool.{method_name}', SVNImplementation, '*'))
     with pass_on_exc(ImportError):
         from forgehg.model.hg import HgImplementation
         timers.append(Timer('hg_tool.{method_name}', HgImplementation,
                             '*'))
     return timers
예제 #2
0
 def scm_lib_timers(self):
     timers = []
     with pass_on_exc(ImportError):
         import forgesvn
         timers.append(
             Timer('svn_lib.{method_name}',
                   forgesvn.model.svn.SVNLibWrapper, 'checkout', 'add',
                   'checkin', 'info2', 'log', 'cat', 'list'))
     with pass_on_exc(ImportError):
         import git
         timers.append(
             Timer('git_lib.{method_name}', git.Repo, 'rev_parse',
                   'iter_commits', 'commit'))
     with pass_on_exc(ImportError):
         import mercurial.hg
         timers.append(
             Timer('hg_lib.{method_name}',
                   mercurial.hg.localrepo.localrepository, 'heads',
                   'branchtags', 'tags'))
     return timers
예제 #3
0
    def timers(self):
        import genshi
        import jinja2
        import markdown
        import ming
        import pymongo
        import socket
        import urllib2
        import activitystream

        timers = self.entry_point_timers() + [
            Timer('activitystream.director.{method_name}',
                  allura.model.timeline.Director, 'create_activity',
                  'create_timeline', 'get_timeline'),
            Timer('activitystream.aggregator.{method_name}',
                  allura.model.timeline.Aggregator, '*'),
            Timer('activitystream.node_manager.{method_name}',
                  activitystream.managers.NodeManager, '*'),
            Timer('activitystream.activity_manager.{method_name}',
                  activitystream.managers.ActivityManager, '*'),
            Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
            Timer('markdown', markdown.Markdown, 'convert'),
            Timer(
                'ming',
                ming.odm.odmsession.ODMCursor,
                'next',  # FIXME: this may captures timings ok, but is misleading for counts
                debug_each_call=False),
            Timer(
                'ming',
                ming.odm.odmsession.ODMSession,
                'insert_now',
                'update_now',
                'delete_now',
                'find',
                'find_and_modify',
                'remove',
                'update',
                'update_if_not_modified',
                'aggregate',
                'group',
                'map_reduce',
                'inline_map_reduce',
                'distinct',
            ),
            Timer('ming',
                  ming.schema.Document,
                  'validate',
                  debug_each_call=False),
            Timer('ming',
                  ming.schema.FancySchemaItem,
                  '_validate_required',
                  '_validate_fast_missing',
                  '_validate_optional',
                  debug_each_call=False),
            Timer('mongo', pymongo.collection.Collection, 'count', 'find',
                  'find_one', 'aggregate', 'group', 'map_reduce',
                  'inline_map_reduce', 'find_and_modify', 'insert', 'save',
                  'update', 'remove', 'drop'),
            Timer('mongo', pymongo.cursor.Cursor, 'count', 'distinct',
                  '_refresh'),
            # urlopen and socket io may or may not overlap partially
            Timer('render', genshi.Stream, 'render'),
            Timer('repo.Blob.{method_name}', allura.model.repository.Blob,
                  '*'),
            Timer('repo.Commit.{method_name}', allura.model.repository.Commit,
                  '*'),
            Timer('repo.LastCommit.{method_name}',
                  allura.model.repository.LastCommit, '*'),
            Timer('repo.Tree.{method_name}', allura.model.repository.Tree,
                  '*'),
            Timer('socket_read',
                  socket._fileobject,
                  'read',
                  'readline',
                  'readlines',
                  debug_each_call=False),
            Timer('socket_write',
                  socket._fileobject,
                  'write',
                  'writelines',
                  'flush',
                  debug_each_call=False),
            Timer('solr', pysolr.Solr, 'add', 'delete', 'search', 'commit'),
            Timer('template', genshi.template.Template, '_prepare', '_parse',
                  'generate'),
            Timer('urlopen', urllib2, 'urlopen'),
            Timer('base_repo_tool.{method_name}',
                  allura.model.repository.RepositoryImplementation,
                  'last_commit_ids'),
        ] + [
            Timer('sidebar', ep.load(), 'sidebar_menu')
            for ep in tool_entry_points
        ]

        try:
            import ldap
        except ImportError:
            pass
        else:
            timers += [
                Timer('ldap', ldap, 'initialize'),
                Timer('ldap', ldap.ldapobject.LDAPObject, 'bind_s', 'unbind_s',
                      'add_s', 'modify_s', 'search_s'),
            ]

        return timers
예제 #4
0
def forgesvn_timers():
    return Timer('svn_tool.{method_name}', SM.svn.SVNImplementation, '*')
예제 #5
0
def svn_timers():
    return Timer(
        'svn_lib.{method_name}', SM.svn.SVNLibWrapper, 'checkout', 'add',
        'checkin', 'info2', 'log', 'cat', 'list')
예제 #6
0
    def timers(self):
        import jinja2
        import markdown
        import ming
        import pymongo
        import socket
        if six.PY2:
            import urllib2 as urlopen_pkg
        else:
            import urllib.requests as urlopen_pkg
        import activitystream
        import pygments
        import difflib
        import requests

        timers = self.entry_point_timers() + [
            Timer(
                'activitystream.director.{method_name}', allura.model.timeline.Director,
                'create_activity', 'create_timeline', 'get_timeline'),
            Timer('activitystream.aggregator.{method_name}',
                  allura.model.timeline.Aggregator, '*'),
            Timer('activitystream.node_manager.{method_name}',
                  activitystream.managers.NodeManager, '*'),
            Timer('activitystream.activity_manager.{method_name}',
                  activitystream.managers.ActivityManager, '*'),
            Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
            Timer('jinja.compile', jinja2.Environment, 'compile'),
            Timer('markdown', markdown.Markdown, 'convert'),
            Timer('ming', ming.odm.odmsession.ODMCursor, 'next',  # FIXME: this may captures timings ok, but is misleading for counts
                  debug_each_call=False),
            Timer('ming', ming.odm.odmsession.ODMSession,
                  'insert_now', 'update_now', 'delete_now',
                  'find', 'find_and_modify', 'remove', 'update', 'update_if_not_modified',
                  'aggregate', 'group', 'map_reduce', 'inline_map_reduce', 'distinct',
                  ),
            Timer('ming', ming.schema.Document, 'validate',
                  debug_each_call=False),
            Timer('ming', ming.schema.FancySchemaItem, '_validate_required',
                  '_validate_fast_missing', '_validate_optional',
                  debug_each_call=False),
            Timer('mongo', pymongo.collection.Collection, 'count', 'find',
                  'find_one', 'aggregate', 'group', 'map_reduce',
                  'inline_map_reduce', 'find_and_modify',
                  'insert', 'save', 'update', 'remove', 'drop'),
            Timer('mongo', pymongo.cursor.Cursor, 'count', 'distinct',
                  '_refresh'),
            # urlopen and socket io may or may not overlap partially
            Timer('repo.Blob.{method_name}', allura.model.repository.Blob, '*'),
            Timer('repo.Commit.{method_name}', allura.model.repository.Commit, '*'),
            Timer('repo.LastCommit.{method_name}',
                  allura.model.repository.LastCommit, '*'),
            Timer('repo.Tree.{method_name}', allura.model.repository.Tree, '*'),
            Timer('socket_read', socket._fileobject, 'read', 'readline',
                  'readlines', debug_each_call=False),
            Timer('socket_write', socket._fileobject, 'write', 'writelines',
                  'flush', debug_each_call=False),
            Timer('solr', pysolr.Solr, 'add', 'delete', 'search', 'commit'),
            Timer('urlopen', urlopen_pkg, 'urlopen'),
            Timer('requests.get', requests, 'get'),
            Timer('base_repo_tool.{method_name}',
                  allura.model.repository.RepositoryImplementation, 'last_commit_ids'),
            Timer('pygments', pygments, 'highlight'),  # often called from within a template so will overlap w/ jinja
            Timer('difflib', difflib, '_mdiff', 'unified_diff'),
            Timer('logging', logging.Logger, '_log', debug_each_call=False),
            Timer('navbar', M.Project, 'nav_data', 'grouped_navbar_entries'),
        ] + [Timer('sidebar', ep.load(), 'sidebar_menu') for ep in tool_entry_points]

        try:
            import ldap
        except ImportError:
            pass
        else:
            timers += [
                Timer('ldap', ldap, 'initialize'),
                Timer('ldap', ldap.ldapobject.LDAPObject,
                      'bind_s', 'unbind_s', 'add_s', 'modify_s', 'search_s'),
            ]

        if self.config.get('memcached_host'):
            import pylibmc
            timers += [
                Timer('memcache.get', pylibmc.client.Client, 'get'),
                Timer('memcache.set', pylibmc.client.Client, 'set'),
            ]

        return timers
예제 #7
0
파일: git_main.py 프로젝트: xmonader/allura
def forgegit_timers():
    return Timer('git_tool.{method_name}', GM.git_repo.GitImplementation, '*')
예제 #8
0
파일: git_main.py 프로젝트: xmonader/allura
def git_timers():
    return [
        Timer('git_lib.{method_name}', git.Repo, 'rev_parse', 'iter_commits',
              'commit'),
        Timer('git_lib.{method_name}', GM.git_repo.GitLibCmdWrapper, 'log'),
    ]
예제 #9
0
    def timers(self):
        import genshi
        import jinja2
        import markdown
        import ming
        import pymongo
        import socket
        import urllib2

        return self.scm_lib_timers() + self.repo_impl_timers() + [
            Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
            Timer('markdown', markdown.Markdown, 'convert'),
            Timer('ming', ming.odm.odmsession.ODMCursor, 'next'),
            Timer('ming', ming.odm.odmsession.ODMSession, 'flush', 'find',
                  'get'),
            Timer('ming',
                  ming.schema.Document,
                  'validate',
                  debug_each_call=False),
            Timer('ming',
                  ming.schema.FancySchemaItem,
                  '_validate_required',
                  '_validate_fast_missing',
                  '_validate_optional',
                  debug_each_call=False),
            Timer('mongo', pymongo.collection.Collection, 'count', 'find',
                  'find_one'),
            Timer('mongo', pymongo.cursor.Cursor, 'count', 'distinct',
                  'explain', 'hint', 'limit', 'next', 'rewind', 'skip', 'sort',
                  'where'),
            # urlopen and socket io may or may not overlap partially
            Timer('render', genshi.Stream, 'render'),
            Timer('repo.Blob.{method_name}', allura.model.repo.Blob, '*'),
            Timer('repo.Commit.{method_name}', allura.model.repo.Commit, '*'),
            Timer('repo.LastCommit.{method_name}',
                  allura.model.repo.LastCommit, '*'),
            Timer('repo.Tree.{method_name}', allura.model.repo.Tree, '*'),
            Timer('socket_read',
                  socket._fileobject,
                  'read',
                  'readline',
                  'readlines',
                  debug_each_call=False),
            Timer('socket_write',
                  socket._fileobject,
                  'write',
                  'writelines',
                  'flush',
                  debug_each_call=False),
            Timer('solr', pysolr.Solr, 'add', 'delete', 'search', 'commit'),
            Timer('template', genshi.template.Template, '_prepare', '_parse',
                  'generate'),
            Timer('urlopen', urllib2, 'urlopen'),
            Timer('_diffs_copied', allura.model.repo.Commit, '_diffs_copied'),
            Timer('sequencematcher.{method_name}',
                  allura.model.repo.SequenceMatcher, 'ratio', 'quick_ratio',
                  'real_quick_ratio'),
            Timer('unified_diff', allura.model.repo, 'unified_diff'),
        ] + [
            Timer('sidebar', ep.load(), 'sidebar_menu')
            for ep in tool_entry_points
        ]
예제 #10
0
    def timers(self):
        import genshi
        import jinja2
        import markdown
        import ming
        import pymongo
        import socket
        import urllib2

        return [
            Timer('markdown', markdown.Markdown, 'convert'),
            Timer('ming', ming.odm.odmsession.ODMCursor, 'next'),
            Timer('ming', ming.odm.odmsession.ODMSession, 'flush', 'find',
                  'get'),
            Timer('ming',
                  ming.schema.Document,
                  'validate',
                  debug_each_call=False),
            Timer('ming',
                  ming.schema.FancySchemaItem,
                  '_validate_required',
                  '_validate_fast_missing',
                  '_validate_optional',
                  debug_each_call=False),
            Timer('mongo', pymongo.collection.Collection, 'count', 'find',
                  'find_one'),
            Timer('mongo', pymongo.cursor.Cursor, 'count', 'distinct',
                  'explain', 'hint', 'limit', 'next', 'rewind', 'skip', 'sort',
                  'where'),
            Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
            # urlopen and socket io may or may not overlap partially
            Timer('urlopen', urllib2, 'urlopen'),
            Timer('render', genshi.Stream, 'render'),
            Timer('socket_read',
                  socket._fileobject,
                  'read',
                  'readline',
                  'readlines',
                  debug_each_call=False),
            Timer('socket_write',
                  socket._fileobject,
                  'write',
                  'writelines',
                  'flush',
                  debug_each_call=False),
            Timer('template', genshi.template.Template, '_prepare', '_parse',
                  'generate'),
            Timer('solr', pysolr.Solr, 'add', 'delete', 'search', 'commit'),
        ]