Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56ac6ff9 authored by Siva Velusamy's avatar Siva Velusamy
Browse files

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

Change-Id: Idfec8f715f6000594b6381cbfdee9fdf6d89f484
parent 93a826f7
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -480,9 +480,12 @@ message GLMessage {
    }

    required int32      context_id = 1;                     // GL context ID
    required Function   function = 2 [default = invalid];   // GL function called
    repeated DataType   args = 3;                           // GL function's arguments
    optional DataType   returnValue = 4;                    // GL function's return value
    optional float      duration = 5;                       // duration of GL call
    optional FrameBuffer fb = 6;                            // contents of the framebuffer
    required int64      start_time = 2;                     // time when call was invoked
    required int32      duration = 3;                       // duration of the call

    required Function   function = 4 [default = invalid];   // GL function called
    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
};
+101 −64
Original line number Diff line number Diff line
@@ -1536,10 +1536,11 @@ void GLMessage_FrameBuffer::Swap(GLMessage_FrameBuffer* other) {

#ifndef _MSC_VER
const int GLMessage::kContextIdFieldNumber;
const int GLMessage::kStartTimeFieldNumber;
const int GLMessage::kDurationFieldNumber;
const int GLMessage::kFunctionFieldNumber;
const int GLMessage::kArgsFieldNumber;
const int GLMessage::kReturnValueFieldNumber;
const int GLMessage::kDurationFieldNumber;
const int GLMessage::kFbFieldNumber;
#endif  // !_MSC_VER

@@ -1562,9 +1563,10 @@ GLMessage::GLMessage(const GLMessage& from)
void GLMessage::SharedCtor() {
  _cached_size_ = 0;
  context_id_ = 0;
  start_time_ = GOOGLE_LONGLONG(0);
  duration_ = 0;
  function_ = 3000;
  returnvalue_ = NULL;
  duration_ = 0;
  fb_ = NULL;
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -1598,12 +1600,13 @@ GLMessage* GLMessage::New() const {
void GLMessage::Clear() {
  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    context_id_ = 0;
    start_time_ = GOOGLE_LONGLONG(0);
    duration_ = 0;
    function_ = 3000;
    if (_has_bit(3)) {
    if (_has_bit(5)) {
      if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
    }
    duration_ = 0;
    if (_has_bit(5)) {
    if (_has_bit(6)) {
      if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
    }
  }
@@ -1628,12 +1631,44 @@ bool GLMessage::MergePartialFromCodedStream(
        } else {
          goto handle_uninterpreted;
        }
        if (input->ExpectTag(16)) goto parse_function;
        if (input->ExpectTag(16)) goto parse_start_time;
        break;
      }
      
      // required .android.gltrace.GLMessage.Function function = 2 [default = invalid];
      // required int64 start_time = 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) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
         parse_function:
@@ -1647,12 +1682,12 @@ bool GLMessage::MergePartialFromCodedStream(
        } else {
          goto handle_uninterpreted;
        }
        if (input->ExpectTag(26)) goto parse_args;
        if (input->ExpectTag(42)) goto parse_args;
        break;
      }
      
      // repeated .android.gltrace.GLMessage.DataType args = 3;
      case 3: {
      // repeated .android.gltrace.GLMessage.DataType args = 5;
      case 5: {
        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
         parse_args:
@@ -1661,13 +1696,13 @@ bool GLMessage::MergePartialFromCodedStream(
        } else {
          goto handle_uninterpreted;
        }
        if (input->ExpectTag(26)) goto parse_args;
        if (input->ExpectTag(34)) goto parse_returnValue;
        if (input->ExpectTag(42)) goto parse_args;
        if (input->ExpectTag(50)) goto parse_returnValue;
        break;
      }
      
      // optional .android.gltrace.GLMessage.DataType returnValue = 4;
      case 4: {
      // optional .android.gltrace.GLMessage.DataType returnValue = 6;
      case 6: {
        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
         parse_returnValue:
@@ -1676,28 +1711,12 @@ bool GLMessage::MergePartialFromCodedStream(
        } else {
          goto handle_uninterpreted;
        }
        if (input->ExpectTag(45)) goto parse_duration;
        if (input->ExpectTag(58)) goto parse_fb;
        break;
      }
      
      // optional float duration = 5;
      case 5: {
        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: {
      // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
      case 7: {
        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
         parse_fb:
@@ -1732,33 +1751,38 @@ void GLMessage::SerializeWithCachedSizes(
    ::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)) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      2, this->function(), output);
    ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->start_time(), output);
  }
  
  // repeated .android.gltrace.GLMessage.DataType args = 3;
  for (int i = 0; i < this->args_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessage(
      3, this->args(i), output);
  // required int32 duration = 3;
  if (_has_bit(2)) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->duration(), output);
  }
  
  // optional .android.gltrace.GLMessage.DataType returnValue = 4;
  // required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
  if (_has_bit(3)) {
    ::google::protobuf::internal::WireFormatLite::WriteMessage(
      4, this->returnvalue(), output);
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      4, this->function(), output);
  }
  
  // optional float duration = 5;
  if (_has_bit(4)) {
    ::google::protobuf::internal::WireFormatLite::WriteFloat(5, this->duration(), output);
  // repeated .android.gltrace.GLMessage.DataType args = 5;
  for (int i = 0; i < this->args_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessage(
      5, this->args(i), output);
  }
  
  // optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
  // optional .android.gltrace.GLMessage.DataType returnValue = 6;
  if (_has_bit(5)) {
    ::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());
    }
    
    // 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()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->function());
    }
    
    // optional .android.gltrace.GLMessage.DataType returnValue = 4;
    // optional .android.gltrace.GLMessage.DataType returnValue = 6;
    if (has_returnvalue()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->returnvalue());
    }
    
    // optional float duration = 5;
    if (has_duration()) {
      total_size += 1 + 4;
    }
    
    // optional .android.gltrace.GLMessage.FrameBuffer fb = 6;
    // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
    if (has_fb()) {
      total_size += 1 +
        ::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();
  for (int i = 0; i < this->args_size(); i++) {
    total_size +=
@@ -1827,15 +1860,18 @@ void GLMessage::MergeFrom(const GLMessage& from) {
      set_context_id(from.context_id());
    }
    if (from._has_bit(1)) {
      set_function(from.function());
      set_start_time(from.start_time());
    }
    if (from._has_bit(3)) {
      mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue());
    }
    if (from._has_bit(4)) {
    if (from._has_bit(2)) {
      set_duration(from.duration());
    }
    if (from._has_bit(3)) {
      set_function(from.function());
    }
    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());
    }
  }
@@ -1848,7 +1884,7 @@ void GLMessage::CopyFrom(const GLMessage& from) {
}

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++) {
    if (!this->args(i).IsInitialized()) return false;
@@ -1865,10 +1901,11 @@ bool GLMessage::IsInitialized() const {
void GLMessage::Swap(GLMessage* other) {
  if (other != this) {
    std::swap(context_id_, other->context_id_);
    std::swap(start_time_, other->start_time_);
    std::swap(duration_, other->duration_);
    std::swap(function_, other->function_);
    args_.Swap(&other->args_);
    std::swap(returnvalue_, other->returnvalue_);
    std::swap(duration_, other->duration_);
    std::swap(fb_, other->fb_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    std::swap(_cached_size_, other->_cached_size_);
+70 −46
Original line number Diff line number Diff line
@@ -1249,17 +1249,31 @@ class GLMessage : public ::google::protobuf::MessageLite {
  inline ::google::protobuf::int32 context_id() const;
  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 void clear_function();
  static const int kFunctionFieldNumber = 2;
  static const int kFunctionFieldNumber = 4;
  inline ::android::gltrace::GLMessage_Function function() const;
  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 void clear_args();
  static const int kArgsFieldNumber = 3;
  static const int kArgsFieldNumber = 5;
  inline const ::android::gltrace::GLMessage_DataType& args(int index) const;
  inline ::android::gltrace::GLMessage_DataType* mutable_args(int index);
  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 >*
      mutable_args();
  
  // optional .android.gltrace.GLMessage.DataType returnValue = 4;
  // optional .android.gltrace.GLMessage.DataType returnValue = 6;
  inline bool has_returnvalue() const;
  inline void clear_returnvalue();
  static const int kReturnValueFieldNumber = 4;
  static const int kReturnValueFieldNumber = 6;
  inline const ::android::gltrace::GLMessage_DataType& returnvalue() const;
  inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue();
  
  // optional float duration = 5;
  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;
  // optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
  inline bool has_fb() const;
  inline void clear_fb();
  static const int kFbFieldNumber = 6;
  static const int kFbFieldNumber = 7;
  inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const;
  inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb();
  
@@ -1294,16 +1301,17 @@ class GLMessage : public ::google::protobuf::MessageLite {
  mutable int _cached_size_;
  
  ::google::protobuf::int32 context_id_;
  ::google::protobuf::int64 start_time_;
  ::google::protobuf::int32 duration_;
  int function_;
  ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_;
  ::android::gltrace::GLMessage_DataType* returnvalue_;
  float duration_;
  ::android::gltrace::GLMessage_FrameBuffer* fb_;
  friend void  protobuf_AddDesc_gltrace_2eproto();
  friend void protobuf_AssignDesc_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 != !?
  inline bool _has_bit(int index) const {
@@ -1622,24 +1630,56 @@ inline void GLMessage::set_context_id(::google::protobuf::int32 value) {
  context_id_ = value;
}

// required .android.gltrace.GLMessage.Function function = 2 [default = invalid];
inline bool GLMessage::has_function() const {
// required int64 start_time = 2;
inline bool GLMessage::has_start_time() const {
  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() {
  function_ = 3000;
  _clear_bit(1);
  _clear_bit(3);
}
inline ::android::gltrace::GLMessage_Function GLMessage::function() const {
  return static_cast< ::android::gltrace::GLMessage_Function >(function_);
}
inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) {
  GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value));
  _set_bit(1);
  _set_bit(3);
  function_ = value;
}

// repeated .android.gltrace.GLMessage.DataType args = 3;
// repeated .android.gltrace.GLMessage.DataType args = 5;
inline int GLMessage::args_size() const {
  return args_.size();
}
@@ -1664,52 +1704,36 @@ GLMessage::mutable_args() {
  return &args_;
}

// optional .android.gltrace.GLMessage.DataType returnValue = 4;
// optional .android.gltrace.GLMessage.DataType returnValue = 6;
inline bool GLMessage::has_returnvalue() const {
  return _has_bit(3);
  return _has_bit(5);
}
inline void GLMessage::clear_returnvalue() {
  if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear();
  _clear_bit(3);
  _clear_bit(5);
}
inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const {
  return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_;
}
inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() {
  _set_bit(3);
  _set_bit(5);
  if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType;
  return returnvalue_;
}

// optional float duration = 5;
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;
// optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
inline bool GLMessage::has_fb() const {
  return _has_bit(5);
  return _has_bit(6);
}
inline void GLMessage::clear_fb() {
  if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear();
  _clear_bit(5);
  _clear_bit(6);
}
inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const {
  return fb_ != NULL ? *fb_ : *default_instance_->fb_;
}
inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() {
  _set_bit(5);
  _set_bit(6);
  if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer;
  return fb_;
}
+1129 −378

File changed.

Preview size limit exceeded, changes collapsed.

+0 −10
Original line number Diff line number Diff line
@@ -16,18 +16,9 @@
 * 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 gltrace {


// Declarations for GL2 APIs

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_glClipPlanexIMG(GLenum p, const GLfixed *eqn);


}; // namespace gltrace
}; // namespace android
Loading