Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: src/gpu/GrTraceMarker.cpp

Issue 378933002: Improve gpu tracing when applying markers directly to gpu target (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrTraceMarker.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrTraceMarker.h" 9 #include "GrTraceMarker.h"
10 #include "GrTracing.h" 10 #include "GrTracing.h"
(...skipping 21 matching lines...) Expand all
32 void GrTraceMarkerSet::remove(const GrGpuTraceMarker& marker) { 32 void GrTraceMarkerSet::remove(const GrGpuTraceMarker& marker) {
33 SkASSERT(-1 != fMarkerArray.find(marker)); 33 SkASSERT(-1 != fMarkerArray.find(marker));
34 int index = this->fMarkerArray.find(marker); 34 int index = this->fMarkerArray.find(marker);
35 this->fMarkerArray.remove(index); 35 this->fMarkerArray.remove(index);
36 } 36 }
37 37
38 int GrTraceMarkerSet::count() const { 38 int GrTraceMarkerSet::count() const {
39 return this->fMarkerArray.count(); 39 return this->fMarkerArray.count();
40 } 40 }
41 41
42 SkString GrTraceMarkerSet::toStringLast() const {
43 const int numMarkers = this->fMarkerArray.count();
44 SkString marker_string;
45 if (numMarkers > 0) {
46 GrGpuTraceMarker& lastMarker = this->fMarkerArray[numMarkers - 1];
47 marker_string.append(lastMarker.fMarker);
48 if (lastMarker.fID != -1) {
49 marker_string.append("(");
50 marker_string.appendS32(lastMarker.fID);
51 marker_string.append(")");
52 }
53 }
54 return marker_string;
55 }
56
42 SkString GrTraceMarkerSet::toString() const { 57 SkString GrTraceMarkerSet::toString() const {
43 SkTQSort<GrGpuTraceMarker>(this->fMarkerArray.begin(), this->fMarkerArray.en d() - 1); 58 SkTQSort<GrGpuTraceMarker>(this->fMarkerArray.begin(), this->fMarkerArray.en d() - 1);
44 SkString marker_string; 59 SkString marker_string;
45 const char* prevMarkerName = ""; 60 const char* prevMarkerName = "";
46 int prevMarkerID = -1; 61 int prevMarkerID = -1;
47 int counter = 0; 62 int counter = 0;
48 const int numMarkers = this->fMarkerArray.count(); 63 const int numMarkers = this->fMarkerArray.count();
49 64
50 // check used for GrGpuGL device after we've already collapsed all markers 65 // check used for GrGpuGL device after we've already collapsed all markers
51 if (1 == numMarkers && -1 == this->fMarkerArray[0].fID) { 66 if (1 == numMarkers && -1 == this->fMarkerArray[0].fID) {
52 marker_string.append(this->fMarkerArray[0].fMarker); 67 marker_string.append(this->fMarkerArray[0].fMarker);
53 return marker_string; 68 return marker_string;
54 } 69 }
55 70
56 for (int i = 0; i < numMarkers; ++i ) { 71 for (int i = 0; i < numMarkers; ++i ) {
57 GrGpuTraceMarker& currMarker = this->fMarkerArray[i]; 72 GrGpuTraceMarker& currMarker = this->fMarkerArray[i];
58 const char* currCmd = currMarker.fMarker; 73 const char* currCmd = currMarker.fMarker;
59 if (currCmd != prevMarkerName) { 74 if (currCmd != prevMarkerName) {
60 if (counter != 0) { 75 if (prevMarkerID != -1) {
61 marker_string.append(") "); 76 marker_string.append(") ");
62 } 77 }
63 marker_string.append(currCmd); 78 marker_string.append(currCmd);
64 marker_string.append("("); 79 if (currMarker.fID != -1) {
65 marker_string.appendS32(currMarker.fID); 80 marker_string.append("(");
81 marker_string.appendS32(currMarker.fID);
82 }
66 prevMarkerName = currCmd; 83 prevMarkerName = currCmd;
67 } else if (currMarker.fID != prevMarkerID) { 84 } else if (currMarker.fID != prevMarkerID) {
68 marker_string.append(", "); 85 marker_string.append(", ");
69 marker_string.appendS32(currMarker.fID); 86 marker_string.appendS32(currMarker.fID);
70 } 87 }
71 prevMarkerID = currMarker.fID; 88 prevMarkerID = currMarker.fID;
72 ++counter; 89 ++counter;
73 } 90 }
74 if (counter > 0) { 91 if (counter > 0 && prevMarkerID != -1) {
75 marker_string.append(")"); 92 marker_string.append(")");
76 } 93 }
77 return marker_string; 94 return marker_string;
78 } 95 }
79 96
80 GrTraceMarkerSet::Iter GrTraceMarkerSet::begin() const { 97 GrTraceMarkerSet::Iter GrTraceMarkerSet::begin() const {
81 return Iter(this, 0); 98 return Iter(this, 0);
82 } 99 }
83 100
84 GrTraceMarkerSet::Iter GrTraceMarkerSet::end() const { 101 GrTraceMarkerSet::Iter GrTraceMarkerSet::end() const {
85 return Iter(this, this->fMarkerArray.count()); 102 return Iter(this, this->fMarkerArray.count());
86 } 103 }
87 104
OLDNEW
« no previous file with comments | « src/gpu/GrTraceMarker.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698