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

Issue 7767014: Added support to trace_event for passing static string arguments without copy (Closed)

Created:
9 years, 3 months ago by jbates
Modified:
9 years, 3 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Added support to trace_event for passing static string arguments without copy Occasionally you want to add some static string to a trace, such as the __FILE__ string, but don't want the overhead of a allocation/copy. This change let's you specify those as argument values via a new TraceValue type. You specify const char* types to get the no-copy behavior. std::string types are always copied. To force a const char*, specify TRACE_STR_COPY(str). TEST=trace_event_unittest.cc Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=99763

Patch Set 1 #

Patch Set 2 : added tests #

Total comments: 2

Patch Set 3 : . #

Total comments: 1

Patch Set 4 : . #

Patch Set 5 : . #

Total comments: 4

Patch Set 6 : win compile #

Patch Set 7 : fixed _COPY macros, win compile #

Patch Set 8 : . #

Patch Set 9 : more tests #

Patch Set 10 : comments #

Total comments: 4

Patch Set 11 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+183 lines, -50 lines) Patch
M base/debug/trace_event.h View 1 2 3 4 5 6 7 8 9 21 chunks +94 lines, -25 lines 0 comments Download
M base/debug/trace_event.cc View 1 2 3 4 5 6 7 8 9 10 9 chunks +33 lines, -23 lines 0 comments Download
M base/debug/trace_event_unittest.cc View 1 2 3 4 5 6 7 8 3 chunks +56 lines, -2 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
jbates
9 years, 3 months ago (2011-08-29 20:49:57 UTC) #1
nduca
Cool!
9 years, 3 months ago (2011-08-29 21:09:36 UTC) #2
scheib
LGTM http://codereview.chromium.org/7767014/diff/2001/base/debug/trace_event.h File base/debug/trace_event.h (right): http://codereview.chromium.org/7767014/diff/2001/base/debug/trace_event.h#newcode366 base/debug/trace_event.h:366: return TraceValue(rhs, 0); nit: Can you just call ...
9 years, 3 months ago (2011-08-29 21:46:09 UTC) #3
jbates
That's cleaner, thanks Vince. http://codereview.chromium.org/7767014/diff/2001/base/debug/trace_event.h File base/debug/trace_event.h (right): http://codereview.chromium.org/7767014/diff/2001/base/debug/trace_event.h#newcode366 base/debug/trace_event.h:366: return TraceValue(rhs, 0); On 2011/08/29 ...
9 years, 3 months ago (2011-08-29 22:22:20 UTC) #4
jbates
Owner's review, plz!
9 years, 3 months ago (2011-08-29 22:49:34 UTC) #5
Evan Martin
Rather than the macro, why not make the char* ctor not copy and the string& ...
9 years, 3 months ago (2011-08-29 22:57:34 UTC) #6
jbates
On 2011/08/29 22:57:34, Evan Martin wrote: > Rather than the macro, why not make the ...
9 years, 3 months ago (2011-08-29 23:25:52 UTC) #7
nduca
Not to derail the review, but I kinda think Evan has a point on this ...
9 years, 3 months ago (2011-08-29 23:27:16 UTC) #8
Evan Martin
On 2011/08/29 23:25:52, jbates wrote: > I think this is a good idea, but it ...
9 years, 3 months ago (2011-08-29 23:33:16 UTC) #9
jbates
OK, happy to switch to const string& for copied argument values. It's not super dangerous ...
9 years, 3 months ago (2011-08-29 23:44:05 UTC) #10
jbates
Latest CL uses std::string to indicate copy behavior and const char* indicates reference behavior. joth ...
9 years, 3 months ago (2011-08-30 01:47:21 UTC) #11
scheib
http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h File base/debug/trace_event.h (right): http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h#newcode114 base/debug/trace_event.h:114: } while(0) Sorry, I'm confused why the changes were ...
9 years, 3 months ago (2011-08-30 16:16:02 UTC) #12
jbates
http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h File base/debug/trace_event.h (right): http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h#newcode114 base/debug/trace_event.h:114: } while(0) On 2011/08/30 16:16:02, scheib wrote: > Sorry, ...
9 years, 3 months ago (2011-08-30 17:01:51 UTC) #13
John Grabowski
http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h File base/debug/trace_event.h (right): http://codereview.chromium.org/7767014/diff/9007/base/debug/trace_event.h#newcode55 base/debug/trace_event.h:55: // TRACE_EVENT1("category", "event1", Comment should have COPY in the ...
9 years, 3 months ago (2011-08-30 18:13:38 UTC) #14
jbates
jrg: I fixed the _COPY macros to always copy string arg values. I also added ...
9 years, 3 months ago (2011-08-30 22:21:35 UTC) #15
joth
LG - 2 minor suggestions... http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc File base/debug/trace_event.cc (right): http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc#newcode89 base/debug/trace_event.cc:89: *out += as_string()? as_string() ...
9 years, 3 months ago (2011-08-31 13:43:33 UTC) #16
jbates
http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc File base/debug/trace_event.cc (right): http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc#newcode89 base/debug/trace_event.cc:89: *out += as_string()? as_string() : "NULL"; On 2011/08/31 13:43:33, ...
9 years, 3 months ago (2011-08-31 17:11:11 UTC) #17
jbates
On 2011/08/31 17:11:11, jbates wrote: > http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc > File base/debug/trace_event.cc (right): > > http://codereview.chromium.org/7767014/diff/20001/base/debug/trace_event.cc#newcode89 > ...
9 years, 3 months ago (2011-09-02 00:47:08 UTC) #18
jbates
owners ping...
9 years, 3 months ago (2011-09-06 17:17:00 UTC) #19
Evan Martin
9 years, 3 months ago (2011-09-06 17:45:29 UTC) #20
I hope you don't mind, I put the subject of the review int he review description
(the subject is lost when we commit)

LGTM

Powered by Google App Engine
This is Rietveld 408576698