Merge "gltrace: add start time & duration to each traced call."

This commit is contained in:
Siva Velusamy 2012-01-04 12:48:52 -08:00 committed by Android (Google) Code Review
commit 875bdea8be
9 changed files with 1347 additions and 514 deletions

View File

@ -480,9 +480,12 @@ message GLMessage {
} }
required int32 context_id = 1; // GL context ID required int32 context_id = 1; // GL context ID
required Function function = 2 [default = invalid]; // GL function called required int64 start_time = 2; // time when call was invoked
repeated DataType args = 3; // GL function's arguments required int32 duration = 3; // duration of the call
optional DataType returnValue = 4; // GL function's return value
optional float duration = 5; // duration of GL call required Function function = 4 [default = invalid]; // GL function called
optional FrameBuffer fb = 6; // contents of the framebuffer repeated DataType args = 5; // GL function's arguments
optional DataType returnValue = 6; // GL function's return value
optional FrameBuffer fb = 7; // contents of the framebuffer
}; };

View File

@ -1536,10 +1536,11 @@ void GLMessage_FrameBuffer::Swap(GLMessage_FrameBuffer* other) {
#ifndef _MSC_VER #ifndef _MSC_VER
const int GLMessage::kContextIdFieldNumber; const int GLMessage::kContextIdFieldNumber;
const int GLMessage::kStartTimeFieldNumber;
const int GLMessage::kDurationFieldNumber;
const int GLMessage::kFunctionFieldNumber; const int GLMessage::kFunctionFieldNumber;
const int GLMessage::kArgsFieldNumber; const int GLMessage::kArgsFieldNumber;
const int GLMessage::kReturnValueFieldNumber; const int GLMessage::kReturnValueFieldNumber;
const int GLMessage::kDurationFieldNumber;
const int GLMessage::kFbFieldNumber; const int GLMessage::kFbFieldNumber;
#endif // !_MSC_VER #endif // !_MSC_VER
@ -1562,9 +1563,10 @@ GLMessage::GLMessage(const GLMessage& from)
void GLMessage::SharedCtor() { void GLMessage::SharedCtor() {
_cached_size_ = 0; _cached_size_ = 0;
context_id_ = 0; context_id_ = 0;
start_time_ = GOOGLE_LONGLONG(0);
duration_ = 0;
function_ = 3000; function_ = 3000;
returnvalue_ = NULL; returnvalue_ = NULL;
duration_ = 0;
fb_ = NULL; fb_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_)); ::memset(_has_bits_, 0, sizeof(_has_bits_));
} }
@ -1598,12 +1600,13 @@ GLMessage* GLMessage::New() const {
void GLMessage::Clear() { void GLMessage::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
context_id_ = 0; context_id_ = 0;
start_time_ = GOOGLE_LONGLONG(0);
duration_ = 0;
function_ = 3000; function_ = 3000;
if (_has_bit(3)) { if (_has_bit(5)) {
if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
} }
duration_ = 0; if (_has_bit(6)) {
if (_has_bit(5)) {
if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
} }
} }
@ -1628,12 +1631,44 @@ bool GLMessage::MergePartialFromCodedStream(
} else { } else {
goto handle_uninterpreted; goto handle_uninterpreted;
} }
if (input->ExpectTag(16)) goto parse_function; if (input->ExpectTag(16)) goto parse_start_time;
break; break;
} }
// required .android.gltrace.GLMessage.Function function = 2 [default = invalid]; // required int64 start_time = 2;
case 2: { case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, &start_time_)));
_set_bit(1);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(24)) goto parse_duration;
break;
}
// required int32 duration = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_duration:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &duration_)));
_set_bit(2);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_function;
break;
}
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_function: parse_function:
@ -1647,12 +1682,12 @@ bool GLMessage::MergePartialFromCodedStream(
} else { } else {
goto handle_uninterpreted; goto handle_uninterpreted;
} }
if (input->ExpectTag(26)) goto parse_args; if (input->ExpectTag(42)) goto parse_args;
break; break;
} }
// repeated .android.gltrace.GLMessage.DataType args = 3; // repeated .android.gltrace.GLMessage.DataType args = 5;
case 3: { case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_args: parse_args:
@ -1661,13 +1696,13 @@ bool GLMessage::MergePartialFromCodedStream(
} else { } else {
goto handle_uninterpreted; goto handle_uninterpreted;
} }
if (input->ExpectTag(26)) goto parse_args; if (input->ExpectTag(42)) goto parse_args;
if (input->ExpectTag(34)) goto parse_returnValue; if (input->ExpectTag(50)) goto parse_returnValue;
break; break;
} }
// optional .android.gltrace.GLMessage.DataType returnValue = 4; // optional .android.gltrace.GLMessage.DataType returnValue = 6;
case 4: { case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_returnValue: parse_returnValue:
@ -1676,28 +1711,12 @@ bool GLMessage::MergePartialFromCodedStream(
} else { } else {
goto handle_uninterpreted; goto handle_uninterpreted;
} }
if (input->ExpectTag(45)) goto parse_duration; if (input->ExpectTag(58)) goto parse_fb;
break; break;
} }
// optional float duration = 5; // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
case 5: { case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
parse_duration:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &duration_)));
_set_bit(4);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(50)) goto parse_fb;
break;
}
// optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_fb: parse_fb:
@ -1732,33 +1751,38 @@ void GLMessage::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->context_id(), output); ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->context_id(), output);
} }
// required .android.gltrace.GLMessage.Function function = 2 [default = invalid]; // required int64 start_time = 2;
if (_has_bit(1)) { if (_has_bit(1)) {
::google::protobuf::internal::WireFormatLite::WriteEnum( ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->start_time(), output);
2, this->function(), output);
} }
// repeated .android.gltrace.GLMessage.DataType args = 3; // required int32 duration = 3;
if (_has_bit(2)) {
::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->duration(), output);
}
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
if (_has_bit(3)) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
4, this->function(), output);
}
// repeated .android.gltrace.GLMessage.DataType args = 5;
for (int i = 0; i < this->args_size(); i++) { for (int i = 0; i < this->args_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessage( ::google::protobuf::internal::WireFormatLite::WriteMessage(
3, this->args(i), output); 5, this->args(i), output);
} }
// optional .android.gltrace.GLMessage.DataType returnValue = 4; // optional .android.gltrace.GLMessage.DataType returnValue = 6;
if (_has_bit(3)) {
::google::protobuf::internal::WireFormatLite::WriteMessage(
4, this->returnvalue(), output);
}
// optional float duration = 5;
if (_has_bit(4)) {
::google::protobuf::internal::WireFormatLite::WriteFloat(5, this->duration(), output);
}
// optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
if (_has_bit(5)) { if (_has_bit(5)) {
::google::protobuf::internal::WireFormatLite::WriteMessage( ::google::protobuf::internal::WireFormatLite::WriteMessage(
6, this->fb(), output); 6, this->returnvalue(), output);
}
// optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
if (_has_bit(6)) {
::google::protobuf::internal::WireFormatLite::WriteMessage(
7, this->fb(), output);
} }
} }
@ -1774,25 +1798,34 @@ int GLMessage::ByteSize() const {
this->context_id()); this->context_id());
} }
// required .android.gltrace.GLMessage.Function function = 2 [default = invalid]; // required int64 start_time = 2;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->start_time());
}
// required int32 duration = 3;
if (has_duration()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->duration());
}
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
if (has_function()) { if (has_function()) {
total_size += 1 + total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->function()); ::google::protobuf::internal::WireFormatLite::EnumSize(this->function());
} }
// optional .android.gltrace.GLMessage.DataType returnValue = 4; // optional .android.gltrace.GLMessage.DataType returnValue = 6;
if (has_returnvalue()) { if (has_returnvalue()) {
total_size += 1 + total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->returnvalue()); this->returnvalue());
} }
// optional float duration = 5; // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
if (has_duration()) {
total_size += 1 + 4;
}
// optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
if (has_fb()) { if (has_fb()) {
total_size += 1 + total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
@ -1800,7 +1833,7 @@ int GLMessage::ByteSize() const {
} }
} }
// repeated .android.gltrace.GLMessage.DataType args = 3; // repeated .android.gltrace.GLMessage.DataType args = 5;
total_size += 1 * this->args_size(); total_size += 1 * this->args_size();
for (int i = 0; i < this->args_size(); i++) { for (int i = 0; i < this->args_size(); i++) {
total_size += total_size +=
@ -1827,15 +1860,18 @@ void GLMessage::MergeFrom(const GLMessage& from) {
set_context_id(from.context_id()); set_context_id(from.context_id());
} }
if (from._has_bit(1)) { if (from._has_bit(1)) {
set_function(from.function()); set_start_time(from.start_time());
} }
if (from._has_bit(3)) { if (from._has_bit(2)) {
mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue());
}
if (from._has_bit(4)) {
set_duration(from.duration()); set_duration(from.duration());
} }
if (from._has_bit(3)) {
set_function(from.function());
}
if (from._has_bit(5)) { if (from._has_bit(5)) {
mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue());
}
if (from._has_bit(6)) {
mutable_fb()->::android::gltrace::GLMessage_FrameBuffer::MergeFrom(from.fb()); mutable_fb()->::android::gltrace::GLMessage_FrameBuffer::MergeFrom(from.fb());
} }
} }
@ -1848,7 +1884,7 @@ void GLMessage::CopyFrom(const GLMessage& from) {
} }
bool GLMessage::IsInitialized() const { bool GLMessage::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false;
for (int i = 0; i < args_size(); i++) { for (int i = 0; i < args_size(); i++) {
if (!this->args(i).IsInitialized()) return false; if (!this->args(i).IsInitialized()) return false;
@ -1865,10 +1901,11 @@ bool GLMessage::IsInitialized() const {
void GLMessage::Swap(GLMessage* other) { void GLMessage::Swap(GLMessage* other) {
if (other != this) { if (other != this) {
std::swap(context_id_, other->context_id_); std::swap(context_id_, other->context_id_);
std::swap(start_time_, other->start_time_);
std::swap(duration_, other->duration_);
std::swap(function_, other->function_); std::swap(function_, other->function_);
args_.Swap(&other->args_); args_.Swap(&other->args_);
std::swap(returnvalue_, other->returnvalue_); std::swap(returnvalue_, other->returnvalue_);
std::swap(duration_, other->duration_);
std::swap(fb_, other->fb_); std::swap(fb_, other->fb_);
std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_has_bits_[0], other->_has_bits_[0]);
std::swap(_cached_size_, other->_cached_size_); std::swap(_cached_size_, other->_cached_size_);

View File

@ -1249,17 +1249,31 @@ class GLMessage : public ::google::protobuf::MessageLite {
inline ::google::protobuf::int32 context_id() const; inline ::google::protobuf::int32 context_id() const;
inline void set_context_id(::google::protobuf::int32 value); inline void set_context_id(::google::protobuf::int32 value);
// required .android.gltrace.GLMessage.Function function = 2 [default = invalid]; // required int64 start_time = 2;
inline bool has_start_time() const;
inline void clear_start_time();
static const int kStartTimeFieldNumber = 2;
inline ::google::protobuf::int64 start_time() const;
inline void set_start_time(::google::protobuf::int64 value);
// required int32 duration = 3;
inline bool has_duration() const;
inline void clear_duration();
static const int kDurationFieldNumber = 3;
inline ::google::protobuf::int32 duration() const;
inline void set_duration(::google::protobuf::int32 value);
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
inline bool has_function() const; inline bool has_function() const;
inline void clear_function(); inline void clear_function();
static const int kFunctionFieldNumber = 2; static const int kFunctionFieldNumber = 4;
inline ::android::gltrace::GLMessage_Function function() const; inline ::android::gltrace::GLMessage_Function function() const;
inline void set_function(::android::gltrace::GLMessage_Function value); inline void set_function(::android::gltrace::GLMessage_Function value);
// repeated .android.gltrace.GLMessage.DataType args = 3; // repeated .android.gltrace.GLMessage.DataType args = 5;
inline int args_size() const; inline int args_size() const;
inline void clear_args(); inline void clear_args();
static const int kArgsFieldNumber = 3; static const int kArgsFieldNumber = 5;
inline const ::android::gltrace::GLMessage_DataType& args(int index) const; inline const ::android::gltrace::GLMessage_DataType& args(int index) const;
inline ::android::gltrace::GLMessage_DataType* mutable_args(int index); inline ::android::gltrace::GLMessage_DataType* mutable_args(int index);
inline ::android::gltrace::GLMessage_DataType* add_args(); inline ::android::gltrace::GLMessage_DataType* add_args();
@ -1268,24 +1282,17 @@ class GLMessage : public ::google::protobuf::MessageLite {
inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >* inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >*
mutable_args(); mutable_args();
// optional .android.gltrace.GLMessage.DataType returnValue = 4; // optional .android.gltrace.GLMessage.DataType returnValue = 6;
inline bool has_returnvalue() const; inline bool has_returnvalue() const;
inline void clear_returnvalue(); inline void clear_returnvalue();
static const int kReturnValueFieldNumber = 4; static const int kReturnValueFieldNumber = 6;
inline const ::android::gltrace::GLMessage_DataType& returnvalue() const; inline const ::android::gltrace::GLMessage_DataType& returnvalue() const;
inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue(); inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue();
// optional float duration = 5; // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
inline bool has_duration() const;
inline void clear_duration();
static const int kDurationFieldNumber = 5;
inline float duration() const;
inline void set_duration(float value);
// optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
inline bool has_fb() const; inline bool has_fb() const;
inline void clear_fb(); inline void clear_fb();
static const int kFbFieldNumber = 6; static const int kFbFieldNumber = 7;
inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const; inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const;
inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb(); inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb();
@ -1294,16 +1301,17 @@ class GLMessage : public ::google::protobuf::MessageLite {
mutable int _cached_size_; mutable int _cached_size_;
::google::protobuf::int32 context_id_; ::google::protobuf::int32 context_id_;
::google::protobuf::int64 start_time_;
::google::protobuf::int32 duration_;
int function_; int function_;
::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_; ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_;
::android::gltrace::GLMessage_DataType* returnvalue_; ::android::gltrace::GLMessage_DataType* returnvalue_;
float duration_;
::android::gltrace::GLMessage_FrameBuffer* fb_; ::android::gltrace::GLMessage_FrameBuffer* fb_;
friend void protobuf_AddDesc_gltrace_2eproto(); friend void protobuf_AddDesc_gltrace_2eproto();
friend void protobuf_AssignDesc_gltrace_2eproto(); friend void protobuf_AssignDesc_gltrace_2eproto();
friend void protobuf_ShutdownFile_gltrace_2eproto(); friend void protobuf_ShutdownFile_gltrace_2eproto();
::google::protobuf::uint32 _has_bits_[(6 + 31) / 32]; ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
// WHY DOES & HAVE LOWER PRECEDENCE THAN != !? // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
inline bool _has_bit(int index) const { inline bool _has_bit(int index) const {
@ -1622,24 +1630,56 @@ inline void GLMessage::set_context_id(::google::protobuf::int32 value) {
context_id_ = value; context_id_ = value;
} }
// required .android.gltrace.GLMessage.Function function = 2 [default = invalid]; // required int64 start_time = 2;
inline bool GLMessage::has_function() const { inline bool GLMessage::has_start_time() const {
return _has_bit(1); return _has_bit(1);
} }
inline void GLMessage::clear_start_time() {
start_time_ = GOOGLE_LONGLONG(0);
_clear_bit(1);
}
inline ::google::protobuf::int64 GLMessage::start_time() const {
return start_time_;
}
inline void GLMessage::set_start_time(::google::protobuf::int64 value) {
_set_bit(1);
start_time_ = value;
}
// required int32 duration = 3;
inline bool GLMessage::has_duration() const {
return _has_bit(2);
}
inline void GLMessage::clear_duration() {
duration_ = 0;
_clear_bit(2);
}
inline ::google::protobuf::int32 GLMessage::duration() const {
return duration_;
}
inline void GLMessage::set_duration(::google::protobuf::int32 value) {
_set_bit(2);
duration_ = value;
}
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
inline bool GLMessage::has_function() const {
return _has_bit(3);
}
inline void GLMessage::clear_function() { inline void GLMessage::clear_function() {
function_ = 3000; function_ = 3000;
_clear_bit(1); _clear_bit(3);
} }
inline ::android::gltrace::GLMessage_Function GLMessage::function() const { inline ::android::gltrace::GLMessage_Function GLMessage::function() const {
return static_cast< ::android::gltrace::GLMessage_Function >(function_); return static_cast< ::android::gltrace::GLMessage_Function >(function_);
} }
inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) { inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) {
GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value)); GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value));
_set_bit(1); _set_bit(3);
function_ = value; function_ = value;
} }
// repeated .android.gltrace.GLMessage.DataType args = 3; // repeated .android.gltrace.GLMessage.DataType args = 5;
inline int GLMessage::args_size() const { inline int GLMessage::args_size() const {
return args_.size(); return args_.size();
} }
@ -1664,52 +1704,36 @@ GLMessage::mutable_args() {
return &args_; return &args_;
} }
// optional .android.gltrace.GLMessage.DataType returnValue = 4; // optional .android.gltrace.GLMessage.DataType returnValue = 6;
inline bool GLMessage::has_returnvalue() const { inline bool GLMessage::has_returnvalue() const {
return _has_bit(3); return _has_bit(5);
} }
inline void GLMessage::clear_returnvalue() { inline void GLMessage::clear_returnvalue() {
if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
_clear_bit(3); _clear_bit(5);
} }
inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const { inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const {
return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_; return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_;
} }
inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() { inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() {
_set_bit(3); _set_bit(5);
if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType; if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType;
return returnvalue_; return returnvalue_;
} }
// optional float duration = 5; // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
inline bool GLMessage::has_duration() const {
return _has_bit(4);
}
inline void GLMessage::clear_duration() {
duration_ = 0;
_clear_bit(4);
}
inline float GLMessage::duration() const {
return duration_;
}
inline void GLMessage::set_duration(float value) {
_set_bit(4);
duration_ = value;
}
// optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
inline bool GLMessage::has_fb() const { inline bool GLMessage::has_fb() const {
return _has_bit(5); return _has_bit(6);
} }
inline void GLMessage::clear_fb() { inline void GLMessage::clear_fb() {
if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
_clear_bit(5); _clear_bit(6);
} }
inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const { inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const {
return fb_ != NULL ? *fb_ : *default_instance_->fb_; return fb_ != NULL ? *fb_ : *default_instance_->fb_;
} }
inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() { inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() {
_set_bit(5); _set_bit(6);
if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer; if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer;
return fb_; return fb_;
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,18 +16,9 @@
* THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT. * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
*/ */
#include <cutils/log.h>
#include <GLES2/gl2.h>
#include "gltrace.pb.h"
#include "gltrace_context.h"
#include "gltrace_fixup.h"
#include "gltrace_transport.h"
namespace android { namespace android {
namespace gltrace { namespace gltrace {
// Declarations for GL2 APIs // Declarations for GL2 APIs
void GLTrace_glActiveTexture(GLenum texture); void GLTrace_glActiveTexture(GLenum texture);
@ -416,6 +407,5 @@ void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params);
void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn); void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn);
void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn); void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn);
}; // namespace gltrace }; // namespace gltrace
}; // namespace android }; // namespace android

View File

@ -15,6 +15,7 @@
*/ */
#include <cutils/log.h> #include <cutils/log.h>
#include <utils/Timers.h>
#include "gltrace.pb.h" #include "gltrace.pb.h"
#include "gltrace_context.h" #include "gltrace_context.h"
@ -43,6 +44,10 @@ void GLTrace_eglCreateContext(int version, int contextId) {
arg_context->set_type(GLMessage::DataType::INT); arg_context->set_type(GLMessage::DataType::INT);
arg_context->add_intvalue(contextId); arg_context->add_intvalue(contextId);
// set start time and duration
glmessage.set_start_time(systemTime());
glmessage.set_duration(0);
glContext->traceGLMessage(&glmessage); glContext->traceGLMessage(&glmessage);
} }
@ -59,6 +64,10 @@ void GLTrace_eglMakeCurrent(int contextId) {
arg_context->set_type(GLMessage::DataType::INT); arg_context->set_type(GLMessage::DataType::INT);
arg_context->add_intvalue(contextId); arg_context->add_intvalue(contextId);
// set start time and duration
glmessage.set_start_time(systemTime());
glmessage.set_duration(0);
glContext->traceGLMessage(&glmessage); glContext->traceGLMessage(&glmessage);
} }
@ -71,6 +80,11 @@ void GLTrace_eglSwapBuffers(void *dpy, void *draw) {
// read FB0 since that is what is displayed on the screen // read FB0 since that is what is displayed on the screen
fixup_addFBContents(glContext, &glmessage, FB0); fixup_addFBContents(glContext, &glmessage, FB0);
// set start time and duration
glmessage.set_start_time(systemTime());
glmessage.set_duration(0);
glContext->traceGLMessage(&glmessage); glContext->traceGLMessage(&glmessage);
} }

View File

@ -240,10 +240,14 @@ void fixup_glGetFloatv(GLMessage *glmsg) {
arg_params->add_floatvalue(*src); arg_params->add_floatvalue(*src);
} }
void fixupGLMessage(GLTraceContext *context, GLMessage *glmsg) { void fixupGLMessage(GLTraceContext *context, nsecs_t start, nsecs_t end, GLMessage *glmsg) {
// for all messages, set the current context id // for all messages, set the current context id
glmsg->set_context_id(context->getId()); glmsg->set_context_id(context->getId());
// set start time and duration
glmsg->set_start_time(start);
glmsg->set_duration((unsigned)(end - start));
// do any custom message dependent processing // do any custom message dependent processing
switch (glmsg->function()) { switch (glmsg->function()) {
case GLMessage::glGenBuffers: /* void glGenBuffers(GLsizei n, GLuint * buffers); */ case GLMessage::glGenBuffers: /* void glGenBuffers(GLsizei n, GLuint * buffers); */

View File

@ -17,13 +17,15 @@
#ifndef __GLTRACE_FIXUP_H_ #ifndef __GLTRACE_FIXUP_H_
#define __GLTRACE_FIXUP_H_ #define __GLTRACE_FIXUP_H_
#include <utils/Timers.h>
#include "gltrace.pb.h" #include "gltrace.pb.h"
#include "gltrace_context.h" #include "gltrace_context.h"
namespace android { namespace android {
namespace gltrace { namespace gltrace {
void fixupGLMessage(GLTraceContext *curContext, GLMessage *message); void fixupGLMessage(GLTraceContext *curContext, nsecs_t start, nsecs_t end, GLMessage *message);
void fixup_addFBContents(GLTraceContext *curContext, GLMessage *message, FBBinding fbToRead); void fixup_addFBContents(GLTraceContext *curContext, GLMessage *message, FBBinding fbToRead);
}; };

View File

@ -104,7 +104,7 @@ API_SPECS = [
('GL1Ext','../GLES_CM/glext_api.in'), ('GL1Ext','../GLES_CM/glext_api.in'),
] ]
HEADER_TEXT = """/* HEADER_LICENSE = """/*
* Copyright 2011, The Android Open Source Project * Copyright 2011, The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -121,22 +121,25 @@ HEADER_TEXT = """/*
* *
* THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT. * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
*/ */
"""
HEADER_INCLUDES = """
#include <cutils/log.h> #include <cutils/log.h>
#include <utils/Timers.h>
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include "gltrace.pb.h" #include "gltrace.pb.h"
#include "gltrace_context.h" #include "gltrace_context.h"
#include "gltrace_fixup.h" #include "gltrace_fixup.h"
#include "gltrace_transport.h" #include "gltrace_transport.h"
"""
HEADER_NAMESPACE_START = """
namespace android { namespace android {
namespace gltrace { namespace gltrace {
""" """
FOOTER_TEXT = """ FOOTER_TEXT = """
}; // namespace gltrace }; // namespace gltrace
}; // namespace android }; // namespace android
""" """
@ -159,11 +162,13 @@ TRACE_CALL_TEMPLATE = pyratemp.Template(
<!--(end)--> <!--(end)-->
// call function // call function
nsecs_t start_time = systemTime();
<!--(if retType != "void")--> <!--(if retType != "void")-->
$!retType!$ retValue = glContext->hooks->gl.$!callsite!$; $!retType!$ retValue = glContext->hooks->gl.$!callsite!$;
<!--(else)--> <!--(else)-->
glContext->hooks->gl.$!callsite!$; glContext->hooks->gl.$!callsite!$;
<!--(end)--> <!--(end)-->
nsecs_t end_time = systemTime();
<!--(if retType != "void")--> <!--(if retType != "void")-->
// set return value // set return value
@ -173,7 +178,7 @@ TRACE_CALL_TEMPLATE = pyratemp.Template(
rt->$!retDataType.getProtobufCall()!$retValue); rt->$!retDataType.getProtobufCall()!$retValue);
<!--(end)--> <!--(end)-->
fixupGLMessage(glContext, &glmsg); fixupGLMessage(glContext, start_time, end_time, &glmsg);
glContext->traceGLMessage(&glmsg); glContext->traceGLMessage(&glmsg);
<!--(if retType != "void")--> <!--(if retType != "void")-->
@ -350,7 +355,8 @@ def removeDuplicates(apis):
def genHeaders(apis, fname): def genHeaders(apis, fname):
lines = [] lines = []
lines.append(HEADER_TEXT) lines.append(HEADER_LICENSE)
lines.append(HEADER_NAMESPACE_START)
prefix = "" prefix = ""
for api in apis: for api in apis:
if prefix != api.prefix: if prefix != api.prefix:
@ -365,7 +371,9 @@ def genHeaders(apis, fname):
def genSrcs(apis, fname): def genSrcs(apis, fname):
lines = [] lines = []
lines.append(HEADER_TEXT) lines.append(HEADER_LICENSE)
lines.append(HEADER_INCLUDES)
lines.append(HEADER_NAMESPACE_START)
prefix = "" prefix = ""
for api in apis: for api in apis:
if prefix != api.prefix: if prefix != api.prefix: