X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_format.hpp;h=d5fd81b5b9eeacd6f9a6f2da06ac78a90c5353d9;hb=HEAD;hp=cdabeb7d4668934b69afcf6593d656abae917fc3;hpb=46a4839cd1b65981bec9f33b1d7978b821866a51;p=apitrace diff --git a/common/trace_format.hpp b/common/trace_format.hpp index cdabeb7..d5fd81b 100644 --- a/common/trace_format.hpp +++ b/common/trace_format.hpp @@ -26,11 +26,59 @@ /* * Trace binary format. * + * This file defines the trace binary stream, which is then compressed by + * snappy or gzip. + */ + +#ifndef _TRACE_FORMAT_HPP_ +#define _TRACE_FORMAT_HPP_ + +namespace trace { + +/* + * Trace file version number. + * + * We keep backwards compatability reading old traces, i.e., it should always be + * possible to parse and retrace old trace files. + * + * So the trace version number refers not only to changes in the binary format + * representation, but also semantic changes in the way certain functions + * should be retraced. + * + * Writing/editing old traces will not be supported however. An older version + * of apitrace should be used in such circunstances. + * + * Changelog: + * + * - version 0: + * - initial implementation + * + * - version 1: + * - support for GL user arrays -- a blob is provided whenever an user memory + * is referred (whereas before calls that operate wit user memory instead of + * VBOs should be ignore) + * + * - version 2: + * - malloc/free memory calls -- allow to pass user memory as malloc memory + * as opposed to blobs + * - glFlushMappedBufferRange will emit a memcpy only for the flushed range + * (whereas previously it would emit a memcpy for the whole mapped range) + * + * - version 3: + * - enums signatures are recorded for the a whole set of values (not as individual values) + * + * - version 4: + * - call enter events include thread ID + */ +#define TRACE_VERSION 4 + + +/* * Grammar: * * trace = event* EOF * - * event = EVENT_ENTER call_sig call_detail+ + * event = EVENT_ENTER thread_id call_sig call_detail+ * | EVENT_LEAVE call_no call_detail+ * * call_sig = sig_id ( name arg_names )? @@ -48,16 +96,17 @@ * | DOUBLE double * | STRING string * | BLOB string - * | ENUM enum_sig + * | ENUM enum_sig value * | BITMASK bitmask_sig value * | ARRAY length value+ * | STRUCT struct_sig value+ * | OPAQUE int + * | REPR value value * * call_sig = id name arg_name* * | id * - * enum_sig = id name value + * enum_sig = id count (name value)+ * | id * * bitmask_sig = id count (name value)+ @@ -67,41 +116,6 @@ * */ -#ifndef _TRACE_FORMAT_HPP_ -#define _TRACE_FORMAT_HPP_ - -namespace Trace { - -/* - * Trace file version number. - * - * We keep backwards compatability reading old traces, i.e., it should always be - * possible to parse and retrace old trace files. - * - * So the trace version number refers not only to changes in the binary format - * representation, but also semantic changes in the way certain functions - * should be retraced. - * - * Writing/editing old traces will not be supported however. An older version - * of apitrace should be used in such circunstances. - * - * Changelog: - * - * - version 0: - * - initial implementation - * - * - version 1: - * - support for GL user arrays -- a blob is provided whenever an user memory - * is referred (whereas before calls that operate wit user memory instead of - * VBOs should be ignore) - * - * - version 2: - * - malloc/free memory calls -- allow to pass user memory as malloc memory - * as opposed to blobs - * - glFlushMappedBufferRange will emit a memcpy only for the flushed range - * (whereas previously it would emit a memcpy for the whole mapped range) - */ -#define TRACE_VERSION 2 enum Event { EVENT_ENTER = 0, @@ -130,9 +144,10 @@ enum Type { TYPE_ARRAY, TYPE_STRUCT, TYPE_OPAQUE, + TYPE_REPR, }; -} /* namespace Trace */ +} /* namespace trace */ #endif /* _TRACE_FORMAT_HPP_ */