本文整理汇总了Python中trace.Tracer类的典型用法代码示例。如果您正苦于以下问题:Python Tracer类的具体用法?Python Tracer怎么用?Python Tracer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tracer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: header
def header(self, api):
for module in api.modules:
dispatcher = DllDispatcher()
dispatcher.dispatchModule(module)
Tracer.header(self, api)
开发者ID:Aganlengzi,项目名称:apitrace,代码行数:7,代码来源:dlltrace.py
示例2: wrapRet
def wrapRet(self, function, instance):
Tracer.wrapRet(self, function, instance)
# Replace function addresses with ours
if function.name in self.getProcAddressFunctionNames:
print ' %s = _wrapProcAddress(%s, %s);' % (instance, function.args[0].name, instance)
# Keep track of buffer mappings
if function.name in ('glMapBuffer', 'glMapBufferARB'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
print ' if (mapping) {'
print ' mapping->map = %s;' % (instance)
print ' mapping->length = 0;'
print ' __glGetBufferParameteriv(target, GL_BUFFER_SIZE, &mapping->length);'
print ' mapping->write = (access != GL_READ_ONLY);'
print ' mapping->explicit_flush = false;'
print ' }'
if function.name == 'glMapBufferRange':
print ' if (access & GL_MAP_WRITE_BIT) {'
print ' __checkBufferMapRange = true;'
print ' }'
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
print ' if (mapping) {'
print ' mapping->map = %s;' % (instance)
print ' mapping->length = length;'
print ' mapping->write = access & GL_MAP_WRITE_BIT;'
print ' mapping->explicit_flush = access & GL_MAP_FLUSH_EXPLICIT_BIT;'
print ' }'
开发者ID:netconstructor,项目名称:apitrace,代码行数:28,代码来源:gltrace.py
示例3: header
def header(self, api):
print '''
static HINSTANCE g_hDll = NULL;
static PROC
__getPublicProcAddress(LPCSTR lpProcName)
{
if (!g_hDll) {
char szDll[MAX_PATH] = {0};
if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
return NULL;
}
strcat(szDll, "\\\\%s");
g_hDll = LoadLibraryA(szDll);
if (!g_hDll) {
return NULL;
}
}
return GetProcAddress(g_hDll, lpProcName);
}
''' % self.dllname
dispatcher = Dispatcher()
dispatcher.dispatch_api(api)
Tracer.header(self, api)
开发者ID:berkus,项目名称:apitrace,代码行数:31,代码来源:dlltrace.py
示例4: traceApi
def traceApi(self, api):
if self.getProcAddressFunctionNames:
# Generate a function to wrap proc addresses
getProcAddressFunction = api.getFunctionByName(self.getProcAddressFunctionNames[0])
argType = getProcAddressFunction.args[0].type
retType = getProcAddressFunction.type
print 'static %s _wrapProcAddress(%s procName, %s procPtr);' % (retType, argType, retType)
print
Tracer.traceApi(self, api)
print 'static %s _wrapProcAddress(%s procName, %s procPtr) {' % (retType, argType, retType)
print ' if (!procPtr) {'
print ' return procPtr;'
print ' }'
for function in api.functions:
ptype = function_pointer_type(function)
pvalue = function_pointer_value(function)
print ' if (strcmp("%s", (const char *)procName) == 0) {' % function.name
print ' %s = (%s)procPtr;' % (pvalue, ptype)
print ' return (%s)&%s;' % (retType, function.name,)
print ' }'
print ' os::log("apitrace: warning: unknown function \\"%s\\"\\n", (const char *)procName);'
print ' return procPtr;'
print '}'
print
else:
Tracer.traceApi(self, api)
开发者ID:netconstructor,项目名称:apitrace,代码行数:29,代码来源:gltrace.py
示例5: dump_arg_instance
def dump_arg_instance(self, function, arg):
if function.name in self.draw_function_names and arg.name == 'indices':
print ' GLint __element_array_buffer = 0;'
print ' __glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
print ' if (!__element_array_buffer) {'
print ' Trace::LiteralBlob((const void *)%s, count*__gl_type_size(type));' % (arg.name)
print ' } else {'
print ' Trace::LiteralOpaque((const void *)%s);' % (arg.name)
print ' }'
return
# Several GL state functions take GLenum symbolic names as
# integer/floats; so dump the symbolic name whenever possible
if arg.type in (glapi.GLint, glapi.GLfloat) and arg.name == 'param':
assert arg.index > 0
assert function.args[arg.index - 1].name == 'pname'
assert function.args[arg.index - 1].type == glapi.GLenum
print ' if (is_symbolic_pname(pname) && is_symbolic_param(%s)) {' % arg.name
dump_instance(glapi.GLenum, arg.name)
print ' } else {'
Tracer.dump_arg_instance(self, function, arg)
print ' }'
return
Tracer.dump_arg_instance(self, function, arg)
开发者ID:mariuz,项目名称:apitrace,代码行数:25,代码来源:gltrace.py
示例6: header
def header(self, api):
print r'#include "dlltrace.hpp"'
print
for module in api.modules:
dispatcher = DllDispatcher()
dispatcher.dispatchModule(module)
Tracer.header(self, api)
开发者ID:schulmar,项目名称:apitrace,代码行数:9,代码来源:dlltrace.py
示例7: doInvokeFunction
def doInvokeFunction(self, function):
if function.name in self.getProcAddressFunctionNames:
nameArg = function.args[0].name
Tracer.doInvokeFunction(self, function)
# Replace function addresses with ours
# XXX: Doing this here instead of wrapRet means that the trace will
# contain the addresses of the wrapper functions, and not the real
# functions, but in practice this should make no difference.
print " _result = _wrapProcAddress(%s, _result);" % (nameArg,)
else:
Tracer.doInvokeFunction(self, function)
开发者ID:mrzzzrm,项目名称:apitrace,代码行数:12,代码来源:gltrace_vanilla.py
示例8: dump_arg_instance
def dump_arg_instance(self, function, arg):
if function.name in self.draw_function_names and arg.name == 'indices':
print ' GLint __element_array_buffer = 0;'
print ' __glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
print ' if (!__element_array_buffer) {'
print ' Trace::LiteralBlob((const void *)%s, count*__gl_type_size(type));' % (arg.name)
print ' } else {'
print ' Trace::LiteralOpaque((const void *)%s);' % (arg.name)
print ' }'
return
Tracer.dump_arg_instance(self, function, arg)
开发者ID:bgirard,项目名称:apitrace,代码行数:12,代码来源:gltrace.py
示例9: __init__
def __init__(self, node, rationale, **kw):
ResourceAgent.__init__(self, node)
Trader.__init__(self, rationale, **kw)
self.trace = Tracer(node)
self.trace = self.trace.add('%-12s' % self)
self.listen_process = None
self.quote_timeouts = dict()
开发者ID:bloodearnest,项目名称:deal,代码行数:7,代码来源:seller.py
示例10: __init__
def __init__(self, region, node, registry, sync_time, others):
self.region = region
self.node = node
self.registry = registry
self.sync_time = sync_time
self.others = others
self.listen_process = None
self.trace = Tracer(node).add("bkr%-9s" % region)
开发者ID:bloodearnest,项目名称:deal,代码行数:8,代码来源:broker.py
示例11: start_on_node
def start_on_node(self, node):
self.node = node
self.regions.add(self.node.region)
self.trace = Tracer(node)
self.trace = self.trace.add('%-12s' % self)
self.trace = self.trace.add('j%-5d' % self.job.id)
self.trace and self.trace("starting on %s" % node)
self.start()
开发者ID:bloodearnest,项目名称:deal,代码行数:8,代码来源:buyer.py
示例12: Seller
class Seller(ResourceAgent, Trader):
def __init__(self, node, rationale, **kw):
ResourceAgent.__init__(self, node)
Trader.__init__(self, rationale, **kw)
self.trace = Tracer(node)
self.trace = self.trace.add('%-12s' % self)
self.listen_process = None
self.quote_timeouts = dict()
def start(self):
self.listen_process = ListenProcess(self)
activate(self.listen_process, self.listen_process.listen())
def set_quote_timeout(self, quote, trace):
trace and trace("setting rationale timeout %s" % (id, ))
p = RationaleTimeout()
p.start(p.timeout(self, quote.id, quote, self.quote_timeout, trace))
self.quote_timeouts[quote.id] = p
def cancel_quote_timeout(self, id, trace):
if id in self.quote_timeouts:
trace and trace("cancelling rationale timeout %s" % (id, ))
process = self.quote_timeouts[id]
cancel_process(process)
del self.quote_timeouts[id]
elif id in self.timedout:
trace and trace("rationale timeout already fired %s" % (id, ))
elif trace:
trace("WARNING: unknown quote timeout cancelled %s" % (id, ))
def process_quote_timeout(self, id, quote, trace):
if id in self.quote_timeouts:
trace and trace("observing failed quote %s" % (id, ))
self.rationale.observe(quote, False)
self.timedout.add(id)
del self.quote_timeouts[id]
elif id in self.timedout:
trace("WARNING: quote timeout already timed out %s" % (id, ))
else:
trace("WARNING: unknown quote timeout firing %s" % (id, ))
# utility function
def create_quote(self):
self.price = self.rationale.quote()
return Ask(None, self, self.resource.free, self.price)
def create_accept(self, quote):
return Ask(quote.buyer, self, quote.job, quote.price)
def viable_quote(self, q):
return (self.active and
self.bid and
q.price >= self.price and
q.size <= self.node.resource.free)
开发者ID:bloodearnest,项目名称:deal,代码行数:57,代码来源:seller.py
示例13: serializeArgValue
def serializeArgValue(self, function, arg):
if function.name in self.draw_function_names and arg.name == 'indices':
print ' GLint __element_array_buffer = 0;'
print ' __glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
print ' if (!__element_array_buffer) {'
if isinstance(arg.type, stdapi.Array):
print ' trace::localWriter.beginArray(%s);' % arg.type.length
print ' for(GLsizei i = 0; i < %s; ++i) {' % arg.type.length
print ' trace::localWriter.beginElement();'
print ' trace::localWriter.writeBlob(%s[i], count[i]*__gl_type_size(type));' % (arg.name)
print ' trace::localWriter.endElement();'
print ' }'
print ' trace::localWriter.endArray();'
else:
print ' trace::localWriter.writeBlob(%s, count*__gl_type_size(type));' % (arg.name)
print ' } else {'
Tracer.serializeArgValue(self, function, arg)
print ' }'
return
# Recognize offsets instead of blobs when a PBO is bound
if function.name in self.unpack_function_names \
and (isinstance(arg.type, stdapi.Blob) \
or (isinstance(arg.type, stdapi.Const) \
and isinstance(arg.type.type, stdapi.Blob))):
print ' {'
print ' gltrace::Context *ctx = gltrace::getContext();'
print ' GLint __unpack_buffer = 0;'
print ' if (ctx->profile == gltrace::PROFILE_COMPAT)'
print ' __glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &__unpack_buffer);'
print ' if (__unpack_buffer) {'
print ' trace::localWriter.writeOpaque(%s);' % arg.name
print ' } else {'
Tracer.serializeArgValue(self, function, arg)
print ' }'
print ' }'
return
# Several GL state functions take GLenum symbolic names as
# integer/floats; so dump the symbolic name whenever possible
if function.name.startswith('gl') \
and arg.type in (glapi.GLint, glapi.GLfloat, glapi.GLdouble) \
and arg.name == 'param':
assert arg.index > 0
assert function.args[arg.index - 1].name == 'pname'
assert function.args[arg.index - 1].type == glapi.GLenum
print ' if (is_symbolic_pname(pname) && is_symbolic_param(%s)) {' % arg.name
self.serializeValue(glapi.GLenum, arg.name)
print ' } else {'
Tracer.serializeArgValue(self, function, arg)
print ' }'
return
Tracer.serializeArgValue(self, function, arg)
开发者ID:gw280,项目名称:apitrace,代码行数:54,代码来源:gltrace.py
示例14: wrap_ret
def wrap_ret(self, function, instance):
Tracer.wrap_ret(self, function, instance)
if function.name in ('glMapBuffer', 'glMapBufferARB'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
print ' if (mapping) {'
print ' mapping->map = %s;' % (instance)
print ' mapping->length = 0;'
print ' __glGetBufferParameteriv(target, GL_BUFFER_SIZE, &mapping->length);'
print ' mapping->write = (access != GL_READ_ONLY);'
print ' }'
if function.name == 'glMapBufferRange':
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
print ' if (mapping) {'
print ' mapping->map = %s;' % (instance)
print ' mapping->length = length;'
print ' mapping->write = access & GL_MAP_WRITE_BIT;'
print ' }'
开发者ID:mariuz,项目名称:apitrace,代码行数:19,代码来源:gltrace.py
示例15: wrap_ret
def wrap_ret(self, function, instance):
Tracer.wrap_ret(self, function, instance)
if function.name in ("glMapBuffer", "glMapBufferARB"):
print " struct buffer_mapping *mapping = get_buffer_mapping(target);"
print " if (mapping) {"
print " mapping->map = %s;" % (instance)
print " mapping->length = 0;"
print " __glGetBufferParameteriv(target, GL_BUFFER_SIZE, &mapping->length);"
print " mapping->write = (access != GL_READ_ONLY);"
print " }"
if function.name == "glMapBufferRange":
print " struct buffer_mapping *mapping = get_buffer_mapping(target);"
print " if (mapping) {"
print " mapping->map = %s;" % (instance)
print " mapping->length = length;"
print " mapping->write = access & GL_MAP_WRITE_BIT;"
print " }"
开发者ID:putsman,项目名称:apitrace,代码行数:19,代码来源:gltrace.py
示例16: traceApi
def traceApi(self, api):
if self.getProcAddressFunctionNames:
# Generate a function to wrap proc addresses
getProcAddressFunction = api.getFunctionByName(self.getProcAddressFunctionNames[0])
argType = getProcAddressFunction.args[0].type
retType = getProcAddressFunction.type
print 'static %s _wrapProcAddress(%s procName, %s procPtr);' % (retType, argType, retType)
print
Tracer.traceApi(self, api)
print 'static %s _wrapProcAddress(%s procName, %s procPtr) {' % (retType, argType, retType)
# Provide fallback functions to missing debug functions
print ' if (!procPtr) {'
else_ = ''
for function_name in self.debug_functions:
if self.api.getFunctionByName(function_name):
print ' %sif (strcmp("%s", (const char *)procName) == 0) {' % (else_, function_name)
print ' return (%s)&%s;' % (retType, function_name)
print ' }'
else_ = 'else '
print ' %s{' % else_
print ' return NULL;'
print ' }'
print ' }'
for function in api.getAllFunctions():
ptype = function_pointer_type(function)
pvalue = function_pointer_value(function)
print ' if (strcmp("%s", (const char *)procName) == 0) {' % function.name
print ' %s = (%s)procPtr;' % (pvalue, ptype)
print ' return (%s)&%s;' % (retType, function.name,)
print ' }'
print ' os::log("apitrace: warning: unknown function \\"%s\\"\\n", (const char *)procName);'
print ' return procPtr;'
print '}'
print
else:
Tracer.traceApi(self, api)
开发者ID:Shalmezad,项目名称:regal,代码行数:41,代码来源:gltrace.py
示例17: dispatch_function
def dispatch_function(self, function):
if function.name in ('glLinkProgram', 'glLinkProgramARB'):
# These functions have been dispatched already
return
# We implement the GREMEDY extensions, not the driver
if function.name in self.gremedy_functions:
return
if function.name in ('glXGetProcAddress', 'glXGetProcAddressARB', 'wglGetProcAddress'):
if_ = 'if'
for gremedy_function in self.gremedy_functions:
print ' %s (strcmp("%s", (const char *)%s) == 0) {' % (if_, gremedy_function, function.args[0].name)
print ' __result = (%s)&%s;' % (function.type, gremedy_function)
print ' }'
if_ = 'else if'
print ' else {'
Tracer.dispatch_function(self, function)
print ' }'
return
# Override GL extensions
if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'):
Tracer.dispatch_function(self, function, prefix = 'gltrace::__', suffix = '_override')
return
Tracer.dispatch_function(self, function)
开发者ID:kanru,项目名称:apitrace,代码行数:27,代码来源:gltrace.py
示例18: invokeFunction
def invokeFunction(self, function):
# We implement GL_EXT_debug_marker, GL_GREMEDY_*, etc., and not the
# driver
if function.name in self.marker_functions:
return
if function.name in self.getProcAddressFunctionNames:
else_ = ''
for marker_function in self.marker_functions:
if self.api.getFunctionByName(marker_function):
print ' %sif (strcmp("%s", (const char *)%s) == 0) {' % (else_, marker_function, function.args[0].name)
print ' _result = (%s)&%s;' % (function.type, marker_function)
print ' }'
else_ = 'else '
print ' %s{' % else_
Tracer.invokeFunction(self, function)
print ' _result = _wrapProcAddress(%s, _result);' % (function.args[0].name)
print ' }'
return
# Override GL extensions
if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'):
Tracer.invokeFunction(self, function, prefix = 'gltrace::_', suffix = '_override')
return
Tracer.invokeFunction(self, function)
开发者ID:PeterLValve,项目名称:apitrace,代码行数:26,代码来源:gltrace.py
示例19: invokeFunction
def invokeFunction(self, function):
if function.name in ('glLinkProgram', 'glLinkProgramARB'):
# These functions have been dispatched already
return
# We implement GL_EXT_debug_marker, GL_GREMEDY_*, etc., and not the
# driver
if function.name in self.marker_functions:
return
if function.name in ('glXGetProcAddress', 'glXGetProcAddressARB', 'wglGetProcAddress'):
else_ = ''
for marker_function in self.marker_functions:
if self.api.get_function_by_name(marker_function):
print ' %sif (strcmp("%s", (const char *)%s) == 0) {' % (else_, marker_function, function.args[0].name)
print ' __result = (%s)&%s;' % (function.type, marker_function)
print ' }'
else_ = 'else '
print ' %s{' % else_
Tracer.invokeFunction(self, function)
print ' }'
return
# Override GL extensions
if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'):
Tracer.invokeFunction(self, function, prefix = 'gltrace::__', suffix = '_override')
return
Tracer.invokeFunction(self, function)
开发者ID:gw280,项目名称:apitrace,代码行数:29,代码来源:gltrace.py
示例20: serializeArgValue
def serializeArgValue(self, function, arg):
# Recognize offsets instead of blobs when a PBO is bound
if function.name in self.unpack_function_names \
and (isinstance(arg.type, stdapi.Blob) \
or (isinstance(arg.type, stdapi.Const) \
and isinstance(arg.type.type, stdapi.Blob))):
print ' {'
print ' gltrace::Context *ctx = gltrace::getContext();'
print ' GLint _unpack_buffer = 0;'
print ' if (ctx->profile == gltrace::PROFILE_COMPAT)'
print ' _glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &_unpack_buffer);'
print ' if (_unpack_buffer) {'
print ' trace::localWriter.writePointer((uintptr_t)%s);' % arg.name
print ' } else {'
Tracer.serializeArgValue(self, function, arg)
print ' }'
print ' }'
return
# Several GL state functions take GLenum symbolic names as
# integer/floats; so dump the symbolic name whenever possible
if function.name.startswith('gl') \
and arg.type in (glapi.GLint, glapi.GLfloat, glapi.GLdouble) \
and arg.name == 'param':
assert arg.index > 0
assert function.args[arg.index - 1].name == 'pname'
assert function.args[arg.index - 1].type == glapi.GLenum
print ' if (is_symbolic_pname(pname) && is_symbolic_param(%s)) {' % arg.name
self.serializeValue(glapi.GLenum, arg.name)
print ' } else {'
Tracer.serializeArgValue(self, function, arg)
print ' }'
return
Tracer.serializeArgValue(self, function, arg)
开发者ID:Shalmezad,项目名称:regal,代码行数:35,代码来源:gltrace.py
注:本文中的trace.Tracer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论