|
|
Created:
6 years, 6 months ago by Alexander Alekseev Modified:
6 years, 3 months ago Reviewers:
Nikita (slow), jochen (gone - plz use gerrit), sky, Dmitry Polukhin, M-A Ruel, Lei Zhang, dmazzoni, Ilya Sherman CC:
asvitkine+watch_chromium.org, chromium-reviews, davemoore+watch_chromium.org, nkostylev+watch_chromium.org, oshima+watch_chromium.org, stevenjb+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Project:
chromium Visibility:
Public. |
DescriptionCollect UMA statistics on which chrome://flags lead to chrome restart on ChromeOS.
On ChromeOS browser is restarted to apply user flags.
We need to calculate statistics on which flags mostly affect users.
BUG=386313
TEST=unittest
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289919
Patch Set 1 #
Total comments: 12
Patch Set 2 : Fix bug in about_flags.cc. Sdded comments. s/restarting/custom/ #
Total comments: 7
Patch Set 3 : Add switches histogram IDs to about_flags. #Patch Set 4 : Added test for AreSwitchesIdenticalToCurrentCommandLine(..., difference). #
Total comments: 28
Patch Set 5 : Update after review. #
Total comments: 16
Patch Set 6 : Update after review. #Patch Set 7 : Added myself as OWNER of about_flags_switches_histogram_ids.h #Patch Set 8 : Remove "enable-accessibility-script-injection" from about_flags.cc #
Total comments: 3
Patch Set 9 : Remove unused UMA_HISTOGRAM_ID_kEnableAccessibilityScriptInjection. #Patch Set 10 : Move ReportCustomFlags to about_flags.cc #
Total comments: 26
Patch Set 11 : Update after review. #Patch Set 12 : Renamed about_flags_switches_histogram_id.h -> about_flags_switches_histogram_ids.h . #
Total comments: 10
Patch Set 13 : Presubmit hook added. #
Total comments: 8
Patch Set 14 : Removed presubmit hooks, refactored unit test, fixed isolation. #Patch Set 15 : Use UMA_HISTOGRAM_SPARSE_SLOWLY macro. #Patch Set 16 : Use PathService to get DIR_SOURCE_ROOT in unit test. #
Total comments: 36
Patch Set 17 : Update after review. #
Total comments: 8
Patch Set 18 : Update after review. #Patch Set 19 : Report hash(switch name). #
Total comments: 8
Patch Set 20 : Update after review. #
Total comments: 36
Patch Set 21 : Update after review. #
Total comments: 8
Patch Set 22 : Update after review. #
Total comments: 18
Patch Set 23 : Comment updated. #Patch Set 24 : Merge tests. Add test dependency on histograms.xml. #Patch Set 25 : Added a comment why histograms.xml is listed in the sources. #Patch Set 26 : Rebased. #Patch Set 27 : Add exception for histograms.xml. #Patch Set 28 : Added comments to about_flags.cc. Added missing histogram enum entry. #Patch Set 29 : Fix windows build. #Patch Set 30 : Rebased. #Messages
Total messages: 129 (0 generated)
Please review: sky@ : chrome/browser/about_flags.cc chrome/browser/about_flags.h chrome/browser/about_flags_unittest.cc dpolukhin@, nkostylev@ : all
https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.cc File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.c... chrome/browser/about_flags.cc:2160: std::equal(new_flags.begin(), new_flags.end(), active_flags.begin()); result = https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.h File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.h... chrome/browser/about_flags.h:1: // Copyright (c) 2012 The Chromium Authors. All rights reserved. How about adding comment somewhere in this file (not sure that it will get noticed though but still) to add new flags to array? https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... File chrome/browser/chromeos/login/report_restarting_flags.h (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.h:13: void ReportRestartingFlags( nit: Rename to smth like ReportFlags / ReportCustomFlags / ReportUserFlags https://codereview.chromium.org/344883002/diff/1/tools/metrics/histograms/his... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/1/tools/metrics/histograms/his... tools/metrics/histograms/histograms.xml:9550: + A set of chrome flags that required browser restart on Chrome OS. nit: on Chrome OS user sign in.
https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... File chrome/browser/chromeos/login/report_restarting_flags.cc (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.cc:296: LOG(ERROR) << "ReportRestartingFlags(): i=" << i << " \"" Debug output? https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.cc:329: UMA_HISTOGRAM_SPARSE_SLOWLY("Login.RestartingFlags", uma_id); Maybe UMA_HISTOGRAM_ENUMERATION is better suited here, please check with jar@ or someone else.
https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.cc File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.c... chrome/browser/about_flags.cc:2160: std::equal(new_flags.begin(), new_flags.end(), active_flags.begin()); On 2014/06/19 17:08:07, Nikita Kostylev wrote: > result = Done. https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.h File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/about_flags.h... chrome/browser/about_flags.h:1: // Copyright (c) 2012 The Chromium Authors. All rights reserved. On 2014/06/19 17:08:07, Nikita Kostylev wrote: > How about adding comment somewhere in this file (not sure that it will get > noticed though but still) to add new flags to array? Done. https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... File chrome/browser/chromeos/login/report_restarting_flags.cc (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.cc:296: LOG(ERROR) << "ReportRestartingFlags(): i=" << i << " \"" On 2014/06/19 17:26:44, Nikita Kostylev wrote: > Debug output? Done. https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... File chrome/browser/chromeos/login/report_restarting_flags.h (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.h:13: void ReportRestartingFlags( On 2014/06/19 17:08:07, Nikita Kostylev wrote: > nit: Rename to smth like ReportFlags / ReportCustomFlags / ReportUserFlags Done. https://codereview.chromium.org/344883002/diff/1/tools/metrics/histograms/his... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/1/tools/metrics/histograms/his... tools/metrics/histograms/histograms.xml:9550: + A set of chrome flags that required browser restart on Chrome OS. On 2014/06/19 17:08:07, Nikita Kostylev wrote: > nit: on Chrome OS user sign in. Done.
Please review.
https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1940: // chrome/browser/chromeos/login/report_custom_flags.cc This is not maintainable. You need to come up with a better way to make this maintainable. Maybe by exposing some way to get the set of switches? Hopefully in some way that doesn't require you to have a stable index. https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... chrome/browser/about_flags.h:126: std::set<CommandLine::StringType>* out_difference); Add test coverage that out_difference is correctly populated.
https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1940: // chrome/browser/chromeos/login/report_custom_flags.cc On 2014/06/19 20:23:28, sky wrote: > This is not maintainable. You need to come up with a better way to make this > maintainable. Maybe by exposing some way to get the set of switches? Hopefully > in some way that doesn't require you to have a stable index. We need histogram here to know which flags lead to bad user experience most. So we need a stable index here. And even more, it must be in histograms.xml . Right now it is designed in a way, that new flags which were not added to report_custom_flags.cc, will be reported as "unknown flag". And if we see large value in "unknown flag" bucket, we can add these flags manually. On the other hand, I can create script like extract_actions.py to rebuild that table and histograms.xml. And another script to presubmit to check for consistency. But it will not handle merge automatically. It is also problematic to automatically analyze all #ifdefs (like #ifndef OS_ANDROID). So, what design would you prefer?
One possibility would be to use a sparse histogram and log the hash of the command-line flag as the value. This way, you don't have to worry about preserving an arbitrary order and you don't need the table. However, you'll still need to have a mechanism to update histograms.xml with the mapping between hashes and corresponding strings. So probably still a script that parses chrome_switches.cc? And probably run this script on presubmit if the switches file is changed? I guess it's a bit tricky if we consider the scenario where some switches may be defined elsewhere (e.g. in components, or something else). On Fri, Jun 20, 2014 at 2:42 PM, <alemate@chromium.org> wrote: > > https://codereview.chromium.org/344883002/diff/20001/ > chrome/browser/about_flags.cc > File chrome/browser/about_flags.cc (right): > > https://codereview.chromium.org/344883002/diff/20001/ > chrome/browser/about_flags.cc#newcode1940 > chrome/browser/about_flags.cc:1940: // > chrome/browser/chromeos/login/report_custom_flags.cc > On 2014/06/19 20:23:28, sky wrote: > >> This is not maintainable. You need to come up with a better way to >> > make this > >> maintainable. Maybe by exposing some way to get the set of switches? >> > Hopefully > >> in some way that doesn't require you to have a stable index. >> > > We need histogram here to know which flags lead to bad user experience > most. So we need a stable index here. And even more, it must be in > histograms.xml . > > Right now it is designed in a way, that new flags which were not added > to report_custom_flags.cc, will be reported as "unknown flag". > And if we see large value in "unknown flag" bucket, we can add these > flags manually. > > On the other hand, I can create script like extract_actions.py to > rebuild that table and histograms.xml. And another script to presubmit > to check for consistency. But it will not handle merge automatically. It > is also problematic to automatically analyze all #ifdefs (like #ifndef > OS_ANDROID). > > > So, what design would you prefer? > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/06/20 18:49:26, chromium-reviews wrote: > One possibility would be to use a sparse histogram and log the hash of the > command-line flag as the value. This way, you don't have to worry about > preserving an arbitrary order and you don't need the table. > > However, you'll still need to have a mechanism to update histograms.xml > with the mapping between hashes and corresponding strings. So probably > still a script that parses chrome_switches.cc? And probably run this script > on presubmit if the switches file is changed? I guess it's a bit tricky if > we consider the scenario where some switches may be defined elsewhere (e.g. > in components, or something else). To calculate hashes in presubmit hook, we actually need to run preprocessor on chrome_switches.cc in the mode of "Chrome for ChromeOS". Also, as far as I know, we now have another shell, so there are already 2 compile targets "chrome for chromeOS". One including ash/switches and another excluding ;-) So I think that making table with integer indexes is even. > On Fri, Jun 20, 2014 at 2:42 PM, <mailto:alemate@chromium.org> wrote: > > > > > https://codereview.chromium.org/344883002/diff/20001/ > > chrome/browser/about_flags.cc > > File chrome/browser/about_flags.cc (right): > > > > https://codereview.chromium.org/344883002/diff/20001/ > > chrome/browser/about_flags.cc#newcode1940 > > chrome/browser/about_flags.cc:1940: // > > chrome/browser/chromeos/login/report_custom_flags.cc > > On 2014/06/19 20:23:28, sky wrote: > > > >> This is not maintainable. You need to come up with a better way to > >> > > make this > > > >> maintainable. Maybe by exposing some way to get the set of switches? > >> > > Hopefully > > > >> in some way that doesn't require you to have a stable index. > >> > > > > We need histogram here to know which flags lead to bad user experience > > most. So we need a stable index here. And even more, it must be in > > histograms.xml . > > > > Right now it is designed in a way, that new flags which were not added > > to report_custom_flags.cc, will be reported as "unknown flag". > > And if we see large value in "unknown flag" bucket, we can add these > > flags manually. > > > > On the other hand, I can create script like extract_actions.py to > > rebuild that table and histograms.xml. And another script to presubmit > > to check for consistency. But it will not handle merge automatically. It > > is also problematic to automatically analyze all #ifdefs (like #ifndef > > OS_ANDROID). > > > > > > So, what design would you prefer? > > > > https://codereview.chromium.org/344883002/ > > > > To unsubscribe from this group and stop receiving emails from it, send an email > to mailto:chromium-reviews+unsubscribe@chromium.org.
Can you ignore the preprocessor and generate hashes for every entry you see? Having extra stuff in histograms.xml isn't a problem... On 20 Jun 2014 14:55, <alemate@chromium.org> wrote: > On 2014/06/20 18:49:26, chromium-reviews wrote: > >> One possibility would be to use a sparse histogram and log the hash of the >> command-line flag as the value. This way, you don't have to worry about >> preserving an arbitrary order and you don't need the table. >> > > However, you'll still need to have a mechanism to update histograms.xml >> with the mapping between hashes and corresponding strings. So probably >> still a script that parses chrome_switches.cc? And probably run this >> script >> on presubmit if the switches file is changed? I guess it's a bit tricky if >> we consider the scenario where some switches may be defined elsewhere >> (e.g. >> in components, or something else). >> > > To calculate hashes in presubmit hook, we actually need to run > preprocessor on > chrome_switches.cc in the mode of "Chrome for ChromeOS". > > Also, as far as I know, we now have another shell, so there are already 2 > compile > targets "chrome for chromeOS". One including ash/switches and another > excluding > ;-) > > So I think that making table with integer indexes is even. > > > On Fri, Jun 20, 2014 at 2:42 PM, <mailto:alemate@chromium.org> wrote: >> > > > >> > https://codereview.chromium.org/344883002/diff/20001/ >> > chrome/browser/about_flags.cc >> > File chrome/browser/about_flags.cc (right): >> > >> > https://codereview.chromium.org/344883002/diff/20001/ >> > chrome/browser/about_flags.cc#newcode1940 >> > chrome/browser/about_flags.cc:1940: // >> > chrome/browser/chromeos/login/report_custom_flags.cc >> > On 2014/06/19 20:23:28, sky wrote: >> > >> >> This is not maintainable. You need to come up with a better way to >> >> >> > make this >> > >> >> maintainable. Maybe by exposing some way to get the set of switches? >> >> >> > Hopefully >> > >> >> in some way that doesn't require you to have a stable index. >> >> >> > >> > We need histogram here to know which flags lead to bad user experience >> > most. So we need a stable index here. And even more, it must be in >> > histograms.xml . >> > >> > Right now it is designed in a way, that new flags which were not added >> > to report_custom_flags.cc, will be reported as "unknown flag". >> > And if we see large value in "unknown flag" bucket, we can add these >> > flags manually. >> > >> > On the other hand, I can create script like extract_actions.py to >> > rebuild that table and histograms.xml. And another script to presubmit >> > to check for consistency. But it will not handle merge automatically. It >> > is also problematic to automatically analyze all #ifdefs (like #ifndef >> > OS_ANDROID). >> > >> > >> > So, what design would you prefer? >> > >> > https://codereview.chromium.org/344883002/ >> > >> > > To unsubscribe from this group and stop receiving emails from it, send an >> > email > >> to mailto:chromium-reviews+unsubscribe@chromium.org. >> > > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/06/20 19:00:11, chromium-reviews wrote: > Can you ignore the preprocessor and generate hashes for every entry you > see? Having extra stuff in histograms.xml isn't a problem... The only way to translate constant names to actual strings is to actually compile code and run.
It's possible to get pretty good results with a simple Python parser. We do similar things in other places too. I suspect that because the chrome_switches.cc code is pretty uniform, that you should be able to get away with doing that without needing to do full compilation. (Anyway, it's up to you which approach to take, I'm merely making a suggestion.) On Fri, Jun 20, 2014 at 3:14 PM, <alemate@chromium.org> wrote: > On 2014/06/20 19:00:11, chromium-reviews wrote: > >> Can you ignore the preprocessor and generate hashes for every entry you >> see? Having extra stuff in histograms.xml isn't a problem... >> > > The only way to translate constant names to actual strings is to actually > compile > code and run. > > > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/06/20 19:19:29, chromium-reviews wrote: > It's possible to get pretty good results with a simple Python parser. We do > similar things in other places too. I suspect that because the > chrome_switches.cc code is pretty uniform, that you should be able to get > away with doing that without needing to do full compilation. > > (Anyway, it's up to you which approach to take, I'm merely making a > suggestion.) Actually I think that creating parsers, presubmit hooks and other automation is trading support complexity of const char* const chrome_custom_histogram_switches[] for support complexity of presubmit hooks. The problem is that manual support of chrome_custom_histogram_switches[] affect only maintainers of chrome/browser/chromeos/login/* , but presubmit hooks will affect all chrome commits. But sky@ has a lot more experience in that, so I hope to get a piece of advice here.
On Fri, Jun 20, 2014 at 12:27 PM, <alemate@chromium.org> wrote: > On 2014/06/20 19:19:29, chromium-reviews wrote: > >> It's possible to get pretty good results with a simple Python parser. We >> do >> similar things in other places too. I suspect that because the >> chrome_switches.cc code is pretty uniform, that you should be able to get >> away with doing that without needing to do full compilation. >> > > (Anyway, it's up to you which approach to take, I'm merely making a >> suggestion.) >> > > > Actually I think that creating parsers, presubmit hooks and other > automation is trading support complexity of > const char* const chrome_custom_histogram_switches[] > for support complexity of presubmit hooks. > > The problem is that manual support of chrome_custom_histogram_switches[] > affect only maintainers of chrome/browser/chromeos/login/* , but > presubmit hooks will affect all chrome commits. > The problem is we have a comment like: // Add new choice before this line. // // If it can be used on ChromeOS, please also add it to // chrome/browser/chromeos/login/report_custom_flags.cc at the bottom of an approximately 2000 line switch statement. Very few people are going to see it, and then they're going to have to figure out what report_custom_flags.cc is. Worse yet, if I remove a switch I have to look at report_custom_flags.cc and attempt to figure it out, which again, it's easy to miss a comment at the top of ~300 line list. This is painful, tedious and error prone. So, there needs to be an automated way for you to maintain what you want. One thought is add an integer to Experiment. Yes, developers would have to add it, but I think we can deal with it. You could add a unit test to ensure all values are unique. -Scott > But sky@ has a lot more experience in that, so I hope to get a piece of > advice > here. > > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/06/20 22:53:01, sky wrote: > On Fri, Jun 20, 2014 at 12:27 PM, <mailto:alemate@chromium.org> wrote: > > > On 2014/06/20 19:19:29, chromium-reviews wrote: > > > >> It's possible to get pretty good results with a simple Python parser. We > >> do > >> similar things in other places too. I suspect that because the > >> chrome_switches.cc code is pretty uniform, that you should be able to get > >> away with doing that without needing to do full compilation. > >> > > > > (Anyway, it's up to you which approach to take, I'm merely making a > >> suggestion.) > >> > > > > > > Actually I think that creating parsers, presubmit hooks and other > > automation is trading support complexity of > > const char* const chrome_custom_histogram_switches[] > > for support complexity of presubmit hooks. > > > > The problem is that manual support of chrome_custom_histogram_switches[] > > affect only maintainers of chrome/browser/chromeos/login/* , but > > presubmit hooks will affect all chrome commits. > > > > The problem is we have a comment like: > > // Add new choice before this line. > // > // If it can be used on ChromeOS, please also add it to > // chrome/browser/chromeos/login/report_custom_flags.cc > > at the bottom of an approximately 2000 line switch statement. Very few > people are going to see it, and then they're going to have to figure out > what report_custom_flags.cc is. Worse yet, if I remove a switch I have to > look at report_custom_flags.cc and attempt to figure it out, which again, > it's easy to miss a comment at the top of ~300 line list. This is painful, > tedious and error prone. > > So, there needs to be an automated way for you to maintain what you want. > One thought is add an integer to Experiment. Yes, developers would have to > add it, but I think we can deal with it. You could add a unit test to > ensure all values are unique. Thank you for the idea, I'll update CL.
Please review.
I've moved switches histogram IDs to about_flags. I'll add test coverage for: bool AreSwitchesIdenticalToCurrentCommandLine( const base::CommandLine& new_cmdline, const base::CommandLine& active_cmdline, std::set<CommandLine::StringType>* out_difference); But all the rest is done. sky@, what do you think?
https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... File chrome/browser/chromeos/login/report_restarting_flags.cc (right): https://codereview.chromium.org/344883002/diff/1/chrome/browser/chromeos/logi... chrome/browser/chromeos/login/report_restarting_flags.cc:329: UMA_HISTOGRAM_SPARSE_SLOWLY("Login.RestartingFlags", uma_id); On 2014/06/19 17:26:44, Nikita Kostylev wrote: > Maybe UMA_HISTOGRAM_ENUMERATION is better suited here, please check with jar@ or > someone else. As jar@ has suggested, we'd better use SPARSE here. https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/20001/chrome/browser/about_fla... chrome/browser/about_flags.h:126: std::set<CommandLine::StringType>* out_difference); On 2014/06/19 20:23:28, sky wrote: > Add test coverage that out_difference is correctly populated. Done.
I'm a bit swamped at the moment with reviews and demo stuff. I'm swapping myself with thakis. https://codereview.chromium.org/344883002/diff/20001/chrome/browser/chromeos/... File chrome/browser/chromeos/login/report_custom_flags.cc (right): https://codereview.chromium.org/344883002/diff/20001/chrome/browser/chromeos/... chrome/browser/chromeos/login/report_custom_flags.cc:45: This is a mapping between switch name and UMA id. Indexes in this table Hm, I would expect a mapping to have two values, this is actually a list. https://codereview.chromium.org/344883002/diff/20001/chrome/browser/chromeos/... chrome/browser/chromeos/login/report_custom_flags.cc:52: tools/metrics/histogram.xml . I think you mean tools/metrics/histograms/histograms.xml. https://codereview.chromium.org/344883002/diff/20001/chrome/browser/chromeos/... chrome/browser/chromeos/login/report_custom_flags.cc:54: NOTE: This table is intentionally unsorted to force anyone to read this If only it were that easy.
(removing myself, i'm not currently doing chrome stuff)
(removing myself and unchecking "add as reviewer:" :-P)
*SIGH* Lets try thestig.
If you go with the manually curated enum list, consider writing a presubmit check that only runs when about_flags_switches_histogram_ids.h changes to enforce the rules for that file. That might help alleviate sky@'s concerns about maintainability. There's a whole bunch of files that have restrictions like this, and I can assure you some developer somewhere will ignore your comments.
On 2014/06/25 23:52:16, Lei Zhang wrote: > If you go with the manually curated enum list, consider writing a presubmit > check that only runs when about_flags_switches_histogram_ids.h changes to > enforce the rules for that file. That might help alleviate sky@'s concerns about > maintainability. > > There's a whole bunch of files that have restrictions like this, and I can > assure you some developer somewhere will ignore your comments. There is a unit test, which does exactly what presubmit could do. Check my update to about_flags_unittest.cc .
On 2014/06/26 00:10:23, alemate wrote: > On 2014/06/25 23:52:16, Lei Zhang wrote: > > If you go with the manually curated enum list, consider writing a presubmit > > check that only runs when about_flags_switches_histogram_ids.h changes to > > enforce the rules for that file. That might help alleviate sky@'s concerns > about > > maintainability. > > > > There's a whole bunch of files that have restrictions like this, and I can > > assure you some developer somewhere will ignore your comments. > > There is a unit test, which does exactly what presubmit could do. > Check my update to about_flags_unittest.cc . So one needs to also update |HistogramSwitchesOrdered| in the unit test file whenever they add a new histogram value? Hopefully in one of the 3 places people will get the message and append to the bottom / not accidentally delete an enum value, rather than just modify the test to make things pass? From the perspective of something trying to add a new flag, this feels painful.
Some other thoughts: alemate: Regarding this feature in general: How often do CrOS users mess with about:flags in the first place? isherman: would you guys be willing to be OWNERS for about_flags_switches_histogram_ids.h to make sure it stays in order?
On 2014/06/26 01:17:44, Lei Zhang wrote: > Some other thoughts: > > alemate: Regarding this feature in general: How often do CrOS users mess with > about:flags in the first place? This is the big question we want to know: what is the real impact of flags on [login] user experience on ChromeOS? On the one hand, it's sometimes very painfull (up to 40 seconds "black screen" in some cases). On the other, it is pretty difficult to fix the problem "once and for all" (probably it would never be totally fixed). So we are analyzing the impact.
On 2014/06/26 01:54:50, alemate wrote: > On 2014/06/26 01:17:44, Lei Zhang wrote: > > Some other thoughts: > > > > alemate: Regarding this feature in general: How often do CrOS users mess with > > about:flags in the first place? > > This is the big question we want to know: what is the real impact of flags on > [login] user experience on ChromeOS? > On the one hand, it's sometimes very painfull (up to 40 seconds "black screen" > in some cases). > On the other, it is pretty difficult to fix the problem "once and for all" > (probably it would never be totally fixed). > So we are analyzing the impact. So there's actually already UMA data recorded about flags. See RecordUMAStatistics() in about_flags.cc. Can you record your data in that way to avoid the need to maintain the enum values?
On 2014/06/26 05:25:30, Lei Zhang wrote: > On 2014/06/26 01:54:50, alemate wrote: > > On 2014/06/26 01:17:44, Lei Zhang wrote: > > > Some other thoughts: > > > > > > alemate: Regarding this feature in general: How often do CrOS users mess > with > > > about:flags in the first place? > > > > This is the big question we want to know: what is the real impact of flags on > > [login] user experience on ChromeOS? > > On the one hand, it's sometimes very painfull (up to 40 seconds "black screen" > > in some cases). > > On the other, it is pretty difficult to fix the problem "once and for all" > > (probably it would never be totally fixed). > > So we are analyzing the impact. > > So there's actually already UMA data recorded about flags. See > RecordUMAStatistics() in about_flags.cc. Can you record your data in that way to > avoid the need to maintain the enum values? RecordUMAStatistics() doesn't build histogram. So we do not know the relative impact of flags. To build histogram we need to add numerical IDs. To build IDs we need to keep the list somewhere. That is why we need enums and all around.
On 2014/06/26 14:13:04, alemate wrote: > On 2014/06/26 05:25:30, Lei Zhang wrote: > > On 2014/06/26 01:54:50, alemate wrote: > > > On 2014/06/26 01:17:44, Lei Zhang wrote: > > > > Some other thoughts: > > > > > > > > alemate: Regarding this feature in general: How often do CrOS users mess > > with > > > > about:flags in the first place? > > > > > > This is the big question we want to know: what is the real impact of flags > on > > > [login] user experience on ChromeOS? > > > On the one hand, it's sometimes very painfull (up to 40 seconds "black > screen" > > > in some cases). > > > On the other, it is pretty difficult to fix the problem "once and for all" > > > (probably it would never be totally fixed). > > > So we are analyzing the impact. > > > > So there's actually already UMA data recorded about flags. See > > RecordUMAStatistics() in about_flags.cc. Can you record your data in that way > to > > avoid the need to maintain the enum values? > > RecordUMAStatistics() doesn't build histogram. > So we do not know the relative impact of flags. > To build histogram we need to add numerical IDs. > To build IDs we need to keep the list somewhere. > That is why we need enums and all around. Btw, I've looked up AboutFlags* at https://uma.googleplex.com/p/chrome/counts/ For Chrome OS it has some strange data (as if flags are almost not used at all). Either not reported properly or something else is broken. AboutFlags_StartupTick 1723463 24.3% (367777 users) AboutFlags_enable-nacl 570 0.01% (146 users) AboutFlags_enable-smooth-scrolling 423 0.01% (132 users) AboutFlags_extension-apis 392 0.01% (124 users) AboutFlags_enable-pnacl 260 0.00% (64 users) AboutFlags_enable-nacl-debug 153 0.00% (28 users) AboutFlags_print-preview 43 0.00% (16 users) AboutFlags_enable-nacl-exception-handling 2 0.00% (2 users)
On 2014/06/26 14:56:27, Nikita Kostylev wrote: > On 2014/06/26 14:13:04, alemate wrote: > > On 2014/06/26 05:25:30, Lei Zhang wrote: > > > On 2014/06/26 01:54:50, alemate wrote: > > > > On 2014/06/26 01:17:44, Lei Zhang wrote: > > > > > Some other thoughts: > > > > > > > > > > alemate: Regarding this feature in general: How often do CrOS users mess > > > with > > > > > about:flags in the first place? > > > > > > > > This is the big question we want to know: what is the real impact of flags > > on > > > > [login] user experience on ChromeOS? > > > > On the one hand, it's sometimes very painfull (up to 40 seconds "black > > screen" > > > > in some cases). > > > > On the other, it is pretty difficult to fix the problem "once and for all" > > > > (probably it would never be totally fixed). > > > > So we are analyzing the impact. > > > > > > So there's actually already UMA data recorded about flags. See > > > RecordUMAStatistics() in about_flags.cc. Can you record your data in that > way > > to > > > avoid the need to maintain the enum values? > > > > RecordUMAStatistics() doesn't build histogram. > > So we do not know the relative impact of flags. > > To build histogram we need to add numerical IDs. > > To build IDs we need to keep the list somewhere. > > That is why we need enums and all around. > > Btw, I've looked up AboutFlags* at https://uma.googleplex.com/p/chrome/counts/ > For Chrome OS it has some strange data (as if flags are almost not used at all). > Either not reported properly or something else is broken. > > AboutFlags_StartupTick 1723463 > 24.3% (367777 users) > > AboutFlags_enable-nacl 570 > 0.01% (146 users) > > AboutFlags_enable-smooth-scrolling 423 > 0.01% (132 users) > > AboutFlags_extension-apis 392 > 0.01% (124 users) > > AboutFlags_enable-pnacl 260 > 0.00% (64 users) > > AboutFlags_enable-nacl-debug 153 > 0.00% (28 users) > > AboutFlags_print-preview 43 > 0.00% (16 users) > > AboutFlags_enable-nacl-exception-handling 2 > 0.00% (2 users) Yes, the data does look odd, and if we care, we probably should investigate that and fix it. But given the numbers for StartupTick, AboutFlags_StartupTick, and AboutFlags_foo_flags, isn't that enough data to build a histogram without using UMA_HISTOGRAM and needing enums?
On 2014/06/26 16:42:43, Lei Zhang wrote: > On 2014/06/26 14:56:27, Nikita Kostylev wrote: > > On 2014/06/26 14:13:04, alemate wrote: > > > On 2014/06/26 05:25:30, Lei Zhang wrote: > > > > On 2014/06/26 01:54:50, alemate wrote: > > > > > On 2014/06/26 01:17:44, Lei Zhang wrote: > > > > > > Some other thoughts: > > > > > > > > > > > > alemate: Regarding this feature in general: How often do CrOS users > mess > > > > with > > > > > > about:flags in the first place? > > > > > > > > > > This is the big question we want to know: what is the real impact of > flags > > > on > > > > > [login] user experience on ChromeOS? > > > > > On the one hand, it's sometimes very painfull (up to 40 seconds "black > > > screen" > > > > > in some cases). > > > > > On the other, it is pretty difficult to fix the problem "once and for > all" > > > > > (probably it would never be totally fixed). > > > > > So we are analyzing the impact. > > > > > > > > So there's actually already UMA data recorded about flags. See > > > > RecordUMAStatistics() in about_flags.cc. Can you record your data in that > > way > > > to > > > > avoid the need to maintain the enum values? > > > > > > RecordUMAStatistics() doesn't build histogram. > > > So we do not know the relative impact of flags. > > > To build histogram we need to add numerical IDs. > > > To build IDs we need to keep the list somewhere. > > > That is why we need enums and all around. > > > > Btw, I've looked up AboutFlags* at https://uma.googleplex.com/p/chrome/counts/ > > For Chrome OS it has some strange data (as if flags are almost not used at > all). > > Either not reported properly or something else is broken. > > ... > Yes, the data does look odd, and if we care, we probably should investigate that > and fix it. But given the numbers for StartupTick, AboutFlags_StartupTick, and > AboutFlags_foo_flags, isn't that enough data to build a histogram without using > UMA_HISTOGRAM and needing enums? Do you mean "build a histogram" on a server side? Then we would need this registry on a server side.
We don't need the registry server-side, since it can be the equivalent of a sparse histogram server-side via the name hashes. I think it should be possible to do, I can assist you with the server-side code on this. On Thu, Jun 26, 2014 at 1:32 PM, <alemate@chromium.org> wrote: > On 2014/06/26 16:42:43, Lei Zhang wrote: > >> On 2014/06/26 14:56:27, Nikita Kostylev wrote: >> > On 2014/06/26 14:13:04, alemate wrote: >> > > On 2014/06/26 05:25:30, Lei Zhang wrote: >> > > > On 2014/06/26 01:54:50, alemate wrote: >> > > > > On 2014/06/26 01:17:44, Lei Zhang wrote: >> > > > > > Some other thoughts: >> > > > > > >> > > > > > alemate: Regarding this feature in general: How often do CrOS >> users >> mess >> > > > with >> > > > > > about:flags in the first place? >> > > > > >> > > > > This is the big question we want to know: what is the real impact >> of >> flags >> > > on >> > > > > [login] user experience on ChromeOS? >> > > > > On the one hand, it's sometimes very painfull (up to 40 seconds >> "black >> > > screen" >> > > > > in some cases). >> > > > > On the other, it is pretty difficult to fix the problem "once and >> for >> all" >> > > > > (probably it would never be totally fixed). >> > > > > So we are analyzing the impact. >> > > > >> > > > So there's actually already UMA data recorded about flags. See >> > > > RecordUMAStatistics() in about_flags.cc. Can you record your data in >> > that > >> > way >> > > to >> > > > avoid the need to maintain the enum values? >> > > >> > > RecordUMAStatistics() doesn't build histogram. >> > > So we do not know the relative impact of flags. >> > > To build histogram we need to add numerical IDs. >> > > To build IDs we need to keep the list somewhere. >> > > That is why we need enums and all around. >> > >> > Btw, I've looked up AboutFlags* at >> > https://uma.googleplex.com/p/chrome/counts/ > >> > For Chrome OS it has some strange data (as if flags are almost not used >> at >> all). >> > Either not reported properly or something else is broken. >> > >> > ... > > Yes, the data does look odd, and if we care, we probably should >> investigate >> > that > >> and fix it. But given the numbers for StartupTick, >> AboutFlags_StartupTick, and >> AboutFlags_foo_flags, isn't that enough data to build a histogram without >> > using > >> UMA_HISTOGRAM and needing enums? >> > > Do you mean "build a histogram" on a server side? > Then we would need this registry on a server side. > > > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
I chatted with Alexander but he still likes the UMA_HISTOGRAM as is better than using RecordAction(). I made a pass over patch set 4. Mostly nits: https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:152: {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "", 0}, Can you leave the formatting as is? https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1546: const std::map<std::string, int>& GetSwitchesHistogramId(); Id -> Ids or IdMap https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1973: const std::map<std::string, int>::const_iterator current_pos = Here, just insert(std::make_pair(switch_name, switch_histogram_id)); If the return value is false, DCHECK the returned iterator's value. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1982: if (switches_histogram_id_.size()) ! empty() https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:427: ScopedVector<std::string> histogram_id_to_switch; histogram_id_to_switch_ https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:563: EXPECT_EQ(0U, difference.size()); EXPECT_TRUE(difference.empty()); https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:817: bool ReadLoginCustomFlags(XmlReader& reader, std::map<int, std::string>* out) { Return a std::map<int, std::string> with an empty map as the sentinel value for failure? https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:822: if (++lines > 1000000) { Can we do this without this arbitrary constant? https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:860: void ReadHistogramsXml(std::map<int, std::string>* login_custom_flags_out) { Just return a std::map<int, std::string> and let RVO convert it to this underneath for you. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:96: const std::map<std::string, int>& switch_histogram_id = |switch_histogram_id| -> switch_histogram_ids or switch_histogram_id_map ? https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:98: for (std::set<std::string>::const_iterator i = in general: i -> it for iterators https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:105: const std::string switch_name(&((*i)[2])); i->substring(2) is a bit more readable than &((*i)[2]) https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:126: } // anonymous namespace just // namespace https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:255: // about_flags::AreSwitchesIdenticalToCurrentCommandLine() requires You're in CrOS-only code, you don't need this comment. Just use std::set<CommandLine::StringType>
Please review. Additional reviewer: jochen@ : content/public/common/content_switches.* https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:152: {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "", 0}, On 2014/06/26 20:03:13, Lei Zhang wrote: > Can you leave the formatting as is? Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1546: const std::map<std::string, int>& GetSwitchesHistogramId(); On 2014/06/26 20:03:13, Lei Zhang wrote: > Id -> Ids or IdMap Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1973: const std::map<std::string, int>::const_iterator current_pos = On 2014/06/26 20:03:13, Lei Zhang wrote: > Here, just insert(std::make_pair(switch_name, switch_histogram_id)); If the > return value is false, DCHECK the returned iterator's value. Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags.cc:1982: if (switches_histogram_id_.size()) On 2014/06/26 20:03:13, Lei Zhang wrote: > ! empty() Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:427: ScopedVector<std::string> histogram_id_to_switch; On 2014/06/26 20:03:14, Lei Zhang wrote: > histogram_id_to_switch_ Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:563: EXPECT_EQ(0U, difference.size()); On 2014/06/26 20:03:14, Lei Zhang wrote: > EXPECT_TRUE(difference.empty()); Done. Though this EXPECT_EQ() was intentional to display the number of incorrect elements in the error message. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:817: bool ReadLoginCustomFlags(XmlReader& reader, std::map<int, std::string>* out) { On 2014/06/26 20:03:14, Lei Zhang wrote: > Return a std::map<int, std::string> with an empty map as the sentinel value for > failure? Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:822: if (++lines > 1000000) { On 2014/06/26 20:03:14, Lei Zhang wrote: > Can we do this without this arbitrary constant? Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/about_fla... chrome/browser/about_flags_unittest.cc:860: void ReadHistogramsXml(std::map<int, std::string>* login_custom_flags_out) { On 2014/06/26 20:03:14, Lei Zhang wrote: > Just return a std::map<int, std::string> and let RVO convert it to this > underneath for you. Done. This also implies that ASSERT_* macros cannot be used in fuctions returning non-PODs. Replaced with EXPECT_*. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:96: const std::map<std::string, int>& switch_histogram_id = On 2014/06/26 20:03:14, Lei Zhang wrote: > |switch_histogram_id| -> switch_histogram_ids or switch_histogram_id_map ? Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:98: for (std::set<std::string>::const_iterator i = On 2014/06/26 20:03:14, Lei Zhang wrote: > in general: i -> it for iterators Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:105: const std::string switch_name(&((*i)[2])); On 2014/06/26 20:03:14, Lei Zhang wrote: > i->substring(2) is a bit more readable than &((*i)[2]) Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:126: } // anonymous namespace On 2014/06/26 20:03:14, Lei Zhang wrote: > just // namespace Done. https://codereview.chromium.org/344883002/diff/60001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:255: // about_flags::AreSwitchesIdenticalToCurrentCommandLine() requires On 2014/06/26 20:03:14, Lei Zhang wrote: > You're in CrOS-only code, you don't need this comment. Just use > std::set<CommandLine::StringType> Done.
On 2014/06/27 19:28:37, alemate wrote: > Please review. > > Additional reviewer: > jochen@ : content/public/common/content_switches.* jochen@ : I found one android-only command-line switch, which was used as string constant in about_flags: diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1b93cdc..32a25c2 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1758,7 +1758,9 @@ const Experiment kExperiments[] = { IDS_FLAGS_ENABLE_ACCESSIBILITY_SCRIPT_INJECTION_DESCRIPTION, kOsAndroid, // Java-only switch: ContentSwitches.ENABLE_ACCESSIBILITY_SCRIPT_INJECTION. - SINGLE_VALUE_TYPE("enable-accessibility-script-injection") + SINGLE_VALUE_TYPE( + switches::kEnableAccessibilityScriptInjection, + UMA_HISTOGRAM_ID_kEnableAccessibilityScriptInjection) }, #endif So I've moved it to android section of content_switches .
Did you want to add yourself as an owner for about_flags_switches_histogram_ids.h? https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:152: { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "", 0}, since the open brace has a space after it, the closing brace should match that and have one before https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:2445: bool result = true; you can default to false here, then you can just write: if (new_flags.size() == active_flags.size()) { result = std::equal(...) } https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:2660: out_map->find(switch_name); this shouldn't be here? https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.h:133: const std::map<std::string, int>& GetSwitchesHistogramIds(); Having "typedef std::map<std::string, int> SwitchesHistogramMap" makes the code slightly more readable and saves a few letters. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags_switches_histogram_ids.h:26: enum SWITCHES_UMA_HISTOGRAM_IDS { The enum name should be SwitchesUmaHistogramIds. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Enumer... https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags_switches_histogram_ids.h:32: UMA_HISTOGRAM_ID_kDisableWebRtcHWEncoding, The names here are also not consistent with the style guide, but I can see why you'd want to do this. I'm indifference but just wanted to point it out. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/chromeos/... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:127: VLOG(1) << "ReportCustomFlags(): '" << *it << "', uma_id=" << uma_id; Seems unnecessary to have the LOG(ERROR) and VLOG() reporting the same data. https://codereview.chromium.org/344883002/diff/80001/content/public/common/co... File content/public/common/content_switches.h (right): https://codereview.chromium.org/344883002/diff/80001/content/public/common/co... content/public/common/content_switches.h:267: CONTENT_EXPORT extern const char kEnableAccessibilityScriptInjection[]; alphabetical order please
+jochen Additional reviewer: jochen@ : content/public/common/content_switches.* jochen@ : I found one android-only command-line switch, which was used as string constant in about_flags: diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1b93cdc..32a25c2 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1758,7 +1758,9 @@ const Experiment kExperiments[] = { IDS_FLAGS_ENABLE_ACCESSIBILITY_SCRIPT_INJECTION_DESCRIPTION, kOsAndroid, // Java-only switch: ContentSwitches.ENABLE_ACCESSIBILITY_SCRIPT_INJECTION. - SINGLE_VALUE_TYPE("enable-accessibility-script-injection") + SINGLE_VALUE_TYPE( + switches::kEnableAccessibilityScriptInjection, + UMA_HISTOGRAM_ID_kEnableAccessibilityScriptInjection) }, #endif So I've moved it to android section of content_switches . https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:152: { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "", 0}, On 2014/06/27 19:46:44, Lei Zhang wrote: > since the open brace has a space after it, the closing brace should match that > and have one before Done. The original source had no space before closing brace on most lines ;-) https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:2445: bool result = true; On 2014/06/27 19:46:44, Lei Zhang wrote: > you can default to false here, then you can just write: > > if (new_flags.size() == active_flags.size()) { > result = std::equal(...) > } Done. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.cc:2660: out_map->find(switch_name); On 2014/06/27 19:46:44, Lei Zhang wrote: > this shouldn't be here? Done. It's strange, that it got here. Sorry. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags.h:133: const std::map<std::string, int>& GetSwitchesHistogramIds(); On 2014/06/27 19:46:44, Lei Zhang wrote: > Having "typedef std::map<std::string, int> SwitchesHistogramMap" makes the code > slightly more readable and saves a few letters. Done. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags_switches_histogram_ids.h:26: enum SWITCHES_UMA_HISTOGRAM_IDS { On 2014/06/27 19:46:45, Lei Zhang wrote: > The enum name should be SwitchesUmaHistogramIds. > http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Enumer... Done. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/about_fla... chrome/browser/about_flags_switches_histogram_ids.h:32: UMA_HISTOGRAM_ID_kDisableWebRtcHWEncoding, On 2014/06/27 19:46:45, Lei Zhang wrote: > The names here are also not consistent with the style guide, but I can see why > you'd want to do this. I'm indifference but just wanted to point it out. Yes, I know. But it greatly simplifies code search. https://codereview.chromium.org/344883002/diff/80001/chrome/browser/chromeos/... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/80001/chrome/browser/chromeos/... chrome/browser/chromeos/login/login_utils.cc:127: VLOG(1) << "ReportCustomFlags(): '" << *it << "', uma_id=" << uma_id; On 2014/06/27 19:46:45, Lei Zhang wrote: > Seems unnecessary to have the LOG(ERROR) and VLOG() reporting the same data. Done. It was a debug print. Removed. https://codereview.chromium.org/344883002/diff/80001/content/public/common/co... File content/public/common/content_switches.h (right): https://codereview.chromium.org/344883002/diff/80001/content/public/common/co... content/public/common/content_switches.h:267: CONTENT_EXPORT extern const char kEnableAccessibilityScriptInjection[]; On 2014/06/27 19:46:45, Lei Zhang wrote: > alphabetical order please Done.
where is the switch used? If it's not used in content, it shouldn't be in the content api
On 2014/06/30 15:14:39, jochen wrote: > where is the switch used? If it's not used in content, it shouldn't be in the > content api It's used here: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/abo... So I put it to the same place as nearby switches::kEnableAccessibilityTabSwitcher (which is also androoid-only accessibility switch).
according to crbug.com/356775 this flag should just be removed
On 2014/07/01 08:24:52, jochen wrote: > according to crbug.com/356775 this flag should just be removed Can someone land "CL to remove this flag" before this CL? I see that this flag is still in trunk.
On 2014/06/27 19:46:45, Lei Zhang wrote: > Did you want to add yourself as an owner for > about_flags_switches_histogram_ids.h? Done.
+dmazzoni - can you remove the now obsolete from from crbug.com/356775 so we don't have to add extra stuff for it here?
Sure, you can remove the native android accessibility flag now - or feel free to just ignore it and assign me a bug to remove it by the end of M38. On Wed, Jul 2, 2014 at 6:22 AM, <jochen@chromium.org> wrote: > +dmazzoni - can you remove the now obsolete from from crbug.com/356775 so > we > don't have to add extra stuff for it here? > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/07/02 13:33:45, dmazzoni wrote: > Sure, you can remove the native android accessibility flag now - or feel > free to just ignore it and assign me a bug to remove it by the end of M38. I can only remove 12 lines from about_flags.cc . Removing resources requires java code modifications, so it would better be done by someone with android build environment. So I'll remove 12 lines, and assign an issue to you to remove the rest. > > On Wed, Jul 2, 2014 at 6:22 AM, <mailto:jochen@chromium.org> wrote: > > > +dmazzoni - can you remove the now obsolete from from crbug.com/356775 so > > we > > don't have to add extra stuff for it here? > > > > https://codereview.chromium.org/344883002/ > > > > To unsubscribe from this group and stop receiving emails from it, send an email > to mailto:chromium-reviews+unsubscribe@chromium.org.
I've removed "enable-accessibility-script-injection" from about_flags.cc
chrome/browser/OWNERS lgtm
lgtm Drop the unused UMA_HISTOGRAM_ID_kEnableAccessibilityScriptInjection ?
https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... chrome/browser/chromeos/login/login_utils.cc:127: UMA_HISTOGRAM_SPARSE_SLOWLY("Login.CustomFlags", uma_id); Wouldn't this histogram be useful on other platforms too, not just CrOS? Could it be put in some common startup code?
https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... chrome/browser/chromeos/login/login_utils.cc:127: UMA_HISTOGRAM_SPARSE_SLOWLY("Login.CustomFlags", uma_id); On 2014/07/02 17:45:40, Alexei Svitkine wrote: > Wouldn't this histogram be useful on other platforms too, not just CrOS? > > Could it be put in some common startup code? thestig@: Do you think it is reasonable to create new file: chrome/browser/about_flags_report_custom_flags.cc ?
On 2014/07/02 17:42:46, Lei Zhang wrote: > lgtm > > Drop the unused UMA_HISTOGRAM_ID_kEnableAccessibilityScriptInjection ? Done.
https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... File chrome/browser/chromeos/login/login_utils.cc (right): https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... chrome/browser/chromeos/login/login_utils.cc:127: UMA_HISTOGRAM_SPARSE_SLOWLY("Login.CustomFlags", uma_id); On 2014/07/02 17:55:03, alemate wrote: > On 2014/07/02 17:45:40, Alexei Svitkine wrote: > > Wouldn't this histogram be useful on other platforms too, not just CrOS? > > > > Could it be put in some common startup code? > > thestig@: Do you think it is reasonable to create new file: > > chrome/browser/about_flags_report_custom_flags.cc ? Would about_flags_report_custom_flags.cc just have ReportCustomFlags() in it? How about just adding it to about_flags.cc?
On 2014/07/02 19:01:05, Lei Zhang wrote: > https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... > File chrome/browser/chromeos/login/login_utils.cc (right): > > https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... > chrome/browser/chromeos/login/login_utils.cc:127: > UMA_HISTOGRAM_SPARSE_SLOWLY("Login.CustomFlags", uma_id); > On 2014/07/02 17:55:03, alemate wrote: > > On 2014/07/02 17:45:40, Alexei Svitkine wrote: > > > Wouldn't this histogram be useful on other platforms too, not just CrOS? > > > > > > Could it be put in some common startup code? > > > > thestig@: Do you think it is reasonable to create new file: > > > > chrome/browser/about_flags_report_custom_flags.cc ? > > Would about_flags_report_custom_flags.cc just have ReportCustomFlags() in it? > How about just adding it to about_flags.cc? Done. PTAL.
On 2014/07/02 17:45:41, Alexei Svitkine wrote: > https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... > File chrome/browser/chromeos/login/login_utils.cc (right): > > https://codereview.chromium.org/344883002/diff/140001/chrome/browser/chromeos... > chrome/browser/chromeos/login/login_utils.cc:127: > UMA_HISTOGRAM_SPARSE_SLOWLY("Login.CustomFlags", uma_id); > Wouldn't this histogram be useful on other platforms too, not just CrOS? > > Could it be put in some common startup code? chrome_browser_main_extra_parts_metrics.cc perhaps? Would we want to use a different histogram name there vs. login_utils.cc?
chrome/browser/chromeos/login/* lgtm
isherman@, please review: tools/metrics/histograms/histograms.xml chrome/browser/about_flags_unittest.cc (because about_flags_unittest.cc is now cheking histograms.xml contents)
You may wish to crib more from [ https://code.google.com/p/chromium/codesearch#chromium/src/extensions/browser... ]. That design seems to work fairly well for the extensions team, other than the inevitable frustration from frequent merge conflicts as multiple people simultaneously append entries to the same enum. Note that I'm pointing you at just a single file, but there's also a script that copies over members of this enum into histograms.xml, and a presubmit script that enforces that this enum is updated correctly (i.e. in an append-only fashion). https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags.h:68: const int command_line_switch_histogram_id; Why is this of type int, rather than of type SwitchesUmaHistogramIds (which, incidentally, should probably be given a singular name rather than a plural one)? https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_switches_histogram_ids.h:17: switch was removed. nit: The more standard practice is to prepend "DEPRECATED_" to the enum constant. https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); It seems more appropriate to use a presubmit check, rather than reading and parsing histograms.xml via a test. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:9525: + in. Why log these only on ChromeOS, rather than on all platforms? https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39285: + <int value="0" label="UNKNOWN_FLAG">Unknown flag.</int> nit: I'd abbreviate this to <int value="0" label="Unknown flag"/> https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39289: + <int value="4" label="reserved4">ID 4 reserved for future use.</int> I'm not convinced that these reserved slots are needed, but I guess it doesn't matter a whole lot. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39333: + </int> There is really no reason not to write this as <int value="20" label="file-manager-enable-new-audio-player"/> https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39832: + <int value="243" label="disable-click-delay">disable-click-delay</int> Please include a script to autogenerated this histogram, as is done for other large and frequently updated histograms.
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags.h:68: const int command_line_switch_histogram_id; On 2014/07/08 04:22:11, Ilya Sherman wrote: > Why is this of type int, rather than of type SwitchesUmaHistogramIds (which, > incidentally, should probably be given a singular name rather than a plural > one)? Done. https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_switches_histogram_ids.h:17: switch was removed. On 2014/07/08 04:22:11, Ilya Sherman wrote: > nit: The more standard practice is to prepend "DEPRECATED_" to the enum > constant. Done. https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/08 04:22:11, Ilya Sherman wrote: > It seems more appropriate to use a presubmit check, rather than reading and > parsing histograms.xml via a test. This has been discussed here (and in private talk). presubmit check might be tricky here: 1) There is no list of all command-line switches . So one of the ideas discussed was to grep all constant strings from all source files like *switches*.cc . But it is going to be very unstable. There are also cases like https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/abo... 2) A lot of flags are under different #ifdefs, so you actually need to compile code to parse the list in a stable way. What this CL does: 1) It introduces full list of command-line switches used in about_flags.cc . This list is now manually defined and fixed. 2) It actually verifies that compiled code matches histogram.xml. That is why I've put all checks to test. 3) Unlike presubmit check, this CL cannot involve any damage to commits besides files in CL. So it is less dangerous. That is why I've added histograms.xml parsing. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:9525: + in. On 2014/07/08 04:22:11, Ilya Sherman wrote: > Why log these only on ChromeOS, rather than on all platforms? Because ChromeOS is now the only OS, where this enum is used. I hope that the description will be updated, if it starts to be used on other OS. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39285: + <int value="0" label="UNKNOWN_FLAG">Unknown flag.</int> On 2014/07/08 04:22:11, Ilya Sherman wrote: > nit: I'd abbreviate this to <int value="0" label="Unknown flag"/> The idea is to have here an identifier, that can be searched in source code. I also hope the most often used descriptions to be updated later by the users of histogram. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39333: + </int> On 2014/07/08 04:22:11, Ilya Sherman wrote: > There is really no reason not to write this as > > <int value="20" label="file-manager-enable-new-audio-player"/> Done. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39832: + <int value="243" label="disable-click-delay">disable-click-delay</int> On 2014/07/08 04:22:11, Ilya Sherman wrote: > Please include a script to autogenerated this histogram, as is done for other > large and frequently updated histograms. As there is no list of switch values in about_flags.cc, I see the only source to generate this list could be the source of unit test. So I decided that it would be simplier (and error-prone) not write this script for now.
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/08 20:45:36, alemate wrote: > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > It seems more appropriate to use a presubmit check, rather than reading and > > parsing histograms.xml via a test. > > This has been discussed here (and in private talk). > > presubmit check might be tricky here: > > 1) There is no list of all command-line switches . So one of the ideas discussed > was to grep all constant strings from all source files like *switches*.cc . But > it is going to be very unstable. There are also cases like > https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/abo... > > 2) A lot of flags are under different #ifdefs, so you actually need to compile > code to parse the list in a stable way. > > > What this CL does: > 1) It introduces full list of command-line switches used in about_flags.cc . > This list is now manually defined and fixed. This list needs to be updated every time a new commandline switch is added. That's pretty painful. > 2) It actually verifies that compiled code matches histogram.xml. > That is why I've put all checks to test. The enum doesn't need to be compiled -- it has the same values on all platforms, and is easy to grep through. > 3) Unlike presubmit check, this CL cannot involve any damage to commits besides > files in CL. So it is less dangerous. I don't understand this comment. > That is why I've added histograms.xml parsing. In addition to my concerns above, I find this test code far too complex for a unit test. I can't just look at the test and quickly grok what it's doing. If the test were to fail, it wouldn't be obvious to me whether that's caused by a bug in my code, or a bug in the test code. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:9525: + in. On 2014/07/08 20:45:36, alemate wrote: > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > Why log these only on ChromeOS, rather than on all platforms? > > Because ChromeOS is now the only OS, where this enum is used. > I hope that the description will be updated, if it starts to be used on other > OS. You are currently adding code that only emits data on ChromeOS. My question is: Why only emit on ChromeOS? Why not emit this data on all platforms? https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39832: + <int value="243" label="disable-click-delay">disable-click-delay</int> On 2014/07/08 20:45:37, alemate wrote: > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > Please include a script to autogenerated this histogram, as is done for other > > large and frequently updated histograms. > > As there is no list of switch values in about_flags.cc, I see the only source to > generate this list could be the source of unit test. > > So I decided that it would be simplier (and error-prone) not write this script > for now. There's a list in about_flags_switches_histogram_id.h (which, btw, I would still name about_flags_switches_histogram_ids.h, despite the singular enum name).
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/09 00:10:50, Ilya Sherman wrote: > On 2014/07/08 20:45:36, alemate wrote: > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > It seems more appropriate to use a presubmit check, rather than reading and > > > parsing histograms.xml via a test. > > > > This has been discussed here (and in private talk). > > > > presubmit check might be tricky here: > > > > 1) There is no list of all command-line switches . So one of the ideas > discussed > > was to grep all constant strings from all source files like *switches*.cc . > But > > it is going to be very unstable. There are also cases like > > > https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/abo... > > > > 2) A lot of flags are under different #ifdefs, so you actually need to compile > > code to parse the list in a stable way. > > > > > > What this CL does: > > 1) It introduces full list of command-line switches used in about_flags.cc . > > This list is now manually defined and fixed. > > This list needs to be updated every time a new commandline switch is added. > That's pretty painful. You mean "every time a new commandline switch is added to about_flags" it has to be added to two other files. We do not have to do it for all flags. > > 2) It actually verifies that compiled code matches histogram.xml. > > That is why I've put all checks to test. > > The enum doesn't need to be compiled -- it has the same values on all platforms, > and is easy to grep through. But enum doesn't have string representation of values. Adding switch names as values seems more readable. > > 3) Unlike presubmit check, this CL cannot involve any damage to commits > besides > > files in CL. So it is less dangerous. > > I don't understand this comment. Presubmit checks run on each developer workstation on each commit. If there is an error in presubmit code or environment, it can damage the commit itself. > > That is why I've added histograms.xml parsing. > > In addition to my concerns above, I find this test code far too > complex for a unit test. I can't just look at the test and quickly > grok what it's doing. If the test were to fail, it wouldn't be > obvious to me whether that's caused by a bug in my code, or a bug > in the test code. Probably I should add more comments on what's happening here. https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:9525: + in. On 2014/07/09 00:10:50, Ilya Sherman wrote: > On 2014/07/08 20:45:36, alemate wrote: > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > Why log these only on ChromeOS, rather than on all platforms? > > > > Because ChromeOS is now the only OS, where this enum is used. > > I hope that the description will be updated, if it starts to be used on other > > OS. > > You are currently adding code that only emits data on ChromeOS. My question is: > Why only emit on ChromeOS? > Why not emit this data on all platforms? The data I report here, exists on ChromeOS only. The histogram implementation, can report any set of about_flags. But the actual set named "Login.CustomFlags" exists on ChromeOS only. It is symmetric difference between a set of device owner (plus policy) flags and current user flags. This difference leads to chrome process restart on user login. As you can see in comments (thestig@ and asvitkine@), the histogram code might be used to report other sets of flags, but I don't know what they are planning to report. So I expect future users to update the description (of enum below). https://codereview.chromium.org/344883002/diff/180001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39832: + <int value="243" label="disable-click-delay">disable-click-delay</int> On 2014/07/09 00:10:50, Ilya Sherman wrote: > On 2014/07/08 20:45:37, alemate wrote: > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > Please include a script to autogenerated this histogram, as is done for > other > > > large and frequently updated histograms. > > > > As there is no list of switch values in about_flags.cc, I see the only source > to > > generate this list could be the source of unit test. > > > > So I decided that it would be simplier (and error-prone) not write this script > > for now. > > There's a list in about_flags_switches_histogram_id.h (which, btw, I would still > name about_flags_switches_histogram_ids.h, despite the singular enum name). I've renamed the file.
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/11 18:13:27, alemate wrote: > On 2014/07/09 00:10:50, Ilya Sherman wrote: > > On 2014/07/08 20:45:36, alemate wrote: > > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > > It seems more appropriate to use a presubmit check, rather than reading > and > > > > parsing histograms.xml via a test. > > > > > > This has been discussed here (and in private talk). > > > > > > presubmit check might be tricky here: > > > > > > 1) There is no list of all command-line switches . So one of the ideas > > discussed > > > was to grep all constant strings from all source files like *switches*.cc . > > But > > > it is going to be very unstable. There are also cases like > > > > > > https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/abo... > > > > > > 2) A lot of flags are under different #ifdefs, so you actually need to > compile > > > code to parse the list in a stable way. > > > > > > > > > What this CL does: > > > 1) It introduces full list of command-line switches used in about_flags.cc . > > > This list is now manually defined and fixed. > > > > This list needs to be updated every time a new commandline switch is added. > > That's pretty painful. > > You mean "every time a new commandline switch is added to > about_flags" it has to be added to two other files. We do not have to > do it for all flags. Correct, but new flags are expected to be added to about_flags, so the difference is largely academic. > > > 2) It actually verifies that compiled code matches histogram.xml. > > > That is why I've put all checks to test. > > > > The enum doesn't need to be compiled -- it has the same values on all > platforms, > > and is easy to grep through. > > But enum doesn't have string representation of values. Adding switch > names as values seems more readable. It looks like trimming UMA_HISTOGRAM_ID_ from the enum entry name gives the switch name. > > > 3) Unlike presubmit check, this CL cannot involve any damage to commits > > besides > > > files in CL. So it is less dangerous. > > > > I don't understand this comment. > > Presubmit checks run on each developer workstation on each commit. > If there is an error in presubmit code or environment, it can damage > the commit itself. I still don't understand. Is this a general argument that all presubmit checks should be removed and replaced with tests? The presubmit check that I'm recommending is a read-only check, so I don't understand in what way it might damage a commit.
https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2603: // skip '--' before switch name nit: Comments should be complete sentences, so start with an uppercase letter and end with a period. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2618: << switch_name << "') is unknown."; Can this just be a NOTREACHED()? https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2623: << "' has incorrect format."; Can this just be a NOTREACHED()? https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2626: << *it << "', uma_id=" << uma_id; This seems redundant with the view presented in about:histograms. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2627: UMA_HISTOGRAM_SPARSE_SLOWLY(uma_histogram_hame, uma_id); When using UMA_HISTOGRAM_FOO macros, the histogram name must be a runtime constant. Hence, you should not pass it in as a parameter.
I've added presubmit hook + test for it. jochen@, please review python code. about_flags_switches_histogram_ids_checker_test.py is nearly a copy of strict_enum_value_checker_test.py . https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/12 00:25:10, Ilya Sherman wrote: > On 2014/07/11 18:13:27, alemate wrote: > > On 2014/07/09 00:10:50, Ilya Sherman wrote: > > > On 2014/07/08 20:45:36, alemate wrote: > > > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > > > 2) It actually verifies that compiled code matches histogram.xml. > > > > > That is why I've put all checks to test. > > > > > > The enum doesn't need to be compiled -- it has the same values on all > > platforms, > > > and is easy to grep through. > > > > But enum doesn't have string representation of values. Adding switch > > names as values seems more readable. > > It looks like trimming UMA_HISTOGRAM_ID_ from the enum entry name gives the > switch name. > > > > > 3) Unlike presubmit check, this CL cannot involve any damage to commits > > > besides > > > > files in CL. So it is less dangerous. > > > > > > I don't understand this comment. > > > > Presubmit checks run on each developer workstation on each commit. > > If there is an error in presubmit code or environment, it can damage > > the commit itself. > > I still don't understand. Is this a general argument that all presubmit checks > should be removed and replaced with tests? The presubmit check that I'm > recommending is a read-only check, so I don't understand in what way it might > damage a commit. I think that presubmit checks verify the submitted change itself (like style, attributes, permissions, etc...). They cannot check the build result and should not pretend they can. The functionality should be checked by tests. On the other hand, tests cannot check code style, so presubmit hooks are handy. I've added presubmit hook to check header style. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2603: // skip '--' before switch name On 2014/07/12 00:30:56, Ilya Sherman wrote: > nit: Comments should be complete sentences, so start with an uppercase letter > and end with a period. Done. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2618: << switch_name << "') is unknown."; On 2014/07/12 00:30:56, Ilya Sherman wrote: > Can this just be a NOTREACHED()? Done. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2623: << "' has incorrect format."; On 2014/07/12 00:30:56, Ilya Sherman wrote: > Can this just be a NOTREACHED()? Done. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2626: << *it << "', uma_id=" << uma_id; On 2014/07/12 00:30:56, Ilya Sherman wrote: > This seems redundant with the view presented in about:histograms. ReportCustomFlags is used here to report the difference between two sets of flags. Also, about:histograms is available only until chrome restart. But on ChromeOS restart could happen while there is no access to about:histograms. https://codereview.chromium.org/344883002/diff/220001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2627: UMA_HISTOGRAM_SPARSE_SLOWLY(uma_histogram_hame, uma_id); On 2014/07/12 00:30:56, Ilya Sherman wrote: > When using UMA_HISTOGRAM_FOO macros, the histogram name must be a runtime > constant. Hence, you should not pass it in as a parameter. Done.
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/21 15:22:27, alemate wrote: > On 2014/07/12 00:25:10, Ilya Sherman wrote: > > On 2014/07/11 18:13:27, alemate wrote: > > > On 2014/07/09 00:10:50, Ilya Sherman wrote: > > > > On 2014/07/08 20:45:36, alemate wrote: > > > > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > > > > 2) It actually verifies that compiled code matches histogram.xml. > > > > > > That is why I've put all checks to test. > > > > > > > > The enum doesn't need to be compiled -- it has the same values on all > > > platforms, > > > > and is easy to grep through. > > > > > > But enum doesn't have string representation of values. Adding switch > > > names as values seems more readable. > > > > It looks like trimming UMA_HISTOGRAM_ID_ from the enum entry name gives the > > switch name. > > > > > > > 3) Unlike presubmit check, this CL cannot involve any damage to commits > > > > besides > > > > > files in CL. So it is less dangerous. > > > > > > > > I don't understand this comment. > > > > > > Presubmit checks run on each developer workstation on each commit. > > > If there is an error in presubmit code or environment, it can damage > > > the commit itself. > > > > I still don't understand. Is this a general argument that all presubmit > checks > > should be removed and replaced with tests? The presubmit check that I'm > > recommending is a read-only check, so I don't understand in what way it might > > damage a commit. > > I think that presubmit checks verify the submitted change itself (like style, > attributes, permissions, etc...). They cannot check the build result and should > not pretend they can. The functionality should be checked by tests. On the other > hand, tests cannot check code style, so presubmit hooks are handy. > > I've added presubmit hook to check header style. Sorry, I think we're talking past each other. My suggestion is that you add a presubmit check that verifies that (a) the contents of the enum match the contents of histograms.xml, and that (b) there aren't any unexpected changes to the enum, i.e. that the enum is correctly treated as append-only. You mentioned that a presubmit check cannot verify the build result. I'm not suggesting that it do so. I'm not sure what lines you're thinking along for this -- what build result needs to be verified? Each entry in about:flags is already verified, by the compiler, to have an enum member associated with it -- right? What else about the build result needs to be verified? https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2629: uma_histogram_hame, base::HistogramBase::kUmaTargetedHistogramFlag)); You're only adding a single histogram in this CL, right? Please continue to use the macro to emit to the histogram, but just don't pass the name in as a parameter, i.e. use a literal instead. https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... chrome/browser/about_flags_switches_histogram_ids.h:25: NOTE: multi-line comments / * ... * / are not supported by the PRECOMMIT hook. nit: I'd omit this note, fwiw; let the presubmit speak for itself, if need be. https://codereview.chromium.org/344883002/diff/240001/tools/about_flags_switc... File tools/about_flags_switches_histogram_ids_checker/about_flags_switches_histogram_ids_checker.py (right): https://codereview.chromium.org/344883002/diff/240001/tools/about_flags_switc... tools/about_flags_switches_histogram_ids_checker/about_flags_switches_histogram_ids_checker.py:164: return self.results Can you reuse some of the existing code, rather than just forking it?
https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/180001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:862: histograms_xml.LoadFile("tools/metrics/histograms/histograms.xml")); On 2014/07/21 22:12:59, Ilya Sherman wrote: > On 2014/07/21 15:22:27, alemate wrote: > > On 2014/07/12 00:25:10, Ilya Sherman wrote: > > > On 2014/07/11 18:13:27, alemate wrote: > > > > On 2014/07/09 00:10:50, Ilya Sherman wrote: > > > > > On 2014/07/08 20:45:36, alemate wrote: > > > > > > On 2014/07/08 04:22:11, Ilya Sherman wrote: > > > > > > > 2) It actually verifies that compiled code matches histogram.xml. > > > > > > > That is why I've put all checks to test. > > > > > > > > > > The enum doesn't need to be compiled -- it has the same values on all > > > > platforms, > > > > > and is easy to grep through. > > > > > > > > But enum doesn't have string representation of values. Adding switch > > > > names as values seems more readable. > > > > > > It looks like trimming UMA_HISTOGRAM_ID_ from the enum entry name gives the > > > switch name. > > > > > > > > > 3) Unlike presubmit check, this CL cannot involve any damage to > commits > > > > > besides > > > > > > files in CL. So it is less dangerous. > > > > > > > > > > I don't understand this comment. > > > > > > > > Presubmit checks run on each developer workstation on each commit. > > > > If there is an error in presubmit code or environment, it can damage > > > > the commit itself. > > > > > > I still don't understand. Is this a general argument that all presubmit > > checks > > > should be removed and replaced with tests? The presubmit check that I'm > > > recommending is a read-only check, so I don't understand in what way it > might > > > damage a commit. > > > > I think that presubmit checks verify the submitted change itself (like style, > > attributes, permissions, etc...). They cannot check the build result and > should > > not pretend they can. The functionality should be checked by tests. On the > other > > hand, tests cannot check code style, so presubmit hooks are handy. > > > > I've added presubmit hook to check header style. > > Sorry, I think we're talking past each other. My suggestion is that you add a > presubmit check that verifies that (a) the contents of the enum match the > contents of histograms.xml, and that (b) there aren't any unexpected changes to > the enum, i.e. that the enum is correctly treated as append-only. > > You mentioned that a presubmit check cannot verify the build result. I'm not > suggesting that it do so. I'm not sure what lines you're thinking along for > this -- what build result needs to be verified? Each entry in about:flags is > already verified, by the compiler, to have an enum member associated with it -- > right? What else about the build result needs to be verified? As far as I understand, you do not like the idea of reading histograms.xml in a unit test. And you'd like to drop this unit test completely and replace it with precommit script, am I right? The enum values in about_flags.cc are set by people and we need to check that the mapping between strings (switch names, which are not constants names, but actual strings that are passed to chrome binary) matches strings that we will get in UMA. This can be checked by compiled code only, because parsing about_flags.cc requires compiler. The precommit script you're pointing at, strict_enum_value_checker.py, is used to gather usage of enum. But what we need to monitor is not enum, but actual switch "strings" (I don't know what it should be called as you think that it's not a name.). And enum here is purely internal data. It means that someone, who adds a switch to about_flags, is not interested in correct enum usage. If he makes a mistake in enum value in about_flags.cc , nothing bad would happen to his functionality. So we need to check that strings in about_flags exactly match strings in histograms.xml. And string values are available at compile time only, so there is no way to check it with precommit script. And looking at precommit script that I've added here, it looks to me that manual check of about_flags_switches_histogram_ids.h is less time-consuming then support of 160 lines of non-trivial python code which definitely requires a test for itself. At least for me as I'll be the owner of about_flags_switches_histogram_ids.h ;-) (Probably I'll add it later, when I get tired of pointing at the same errors, but I need some commit statistics.) https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2629: uma_histogram_hame, base::HistogramBase::kUmaTargetedHistogramFlag)); On 2014/07/21 22:12:59, Ilya Sherman wrote: > You're only adding a single histogram in this CL, right? Please continue to use > the macro to emit to the histogram, but just don't pass the name in as a > parameter, i.e. use a literal instead. It would make this function ChromeOS-only, wouldn't it? As far as I understood thestig@, whose idea was to move ReportCustomFlags from chromeos:: to about_flags::, it should be less OS-specific. Maybe you could once introduce non-caching macros? I see that caching is not used in UMA_HISTOGRAM_SPARSE_SLOWLY() macro, so, why don't we have these flags? https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... File chrome/browser/about_flags_switches_histogram_ids.h (right): https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... chrome/browser/about_flags_switches_histogram_ids.h:25: NOTE: multi-line comments / * ... * / are not supported by the PRECOMMIT hook. On 2014/07/21 22:12:59, Ilya Sherman wrote: > nit: I'd omit this note, fwiw; let the presubmit speak for itself, if need be. It's rather painful to convert presubmit warnings to "multi-line comments / * ... * / are not supported". I hope this comment would save several minutes to someone. ;-) https://codereview.chromium.org/344883002/diff/240001/tools/about_flags_switc... File tools/about_flags_switches_histogram_ids_checker/about_flags_switches_histogram_ids_checker.py (right): https://codereview.chromium.org/344883002/diff/240001/tools/about_flags_switc... tools/about_flags_switches_histogram_ids_checker/about_flags_switches_histogram_ids_checker.py:164: return self.results On 2014/07/21 22:12:59, Ilya Sherman wrote: > Can you reuse some of the existing code, rather than just forking it? Hmm. That means splitting strict_enum_value_checker.py (and *_test.py) into an environment library and actual checkers. I'll look into it, but doesn't it seem too much for all this?
I'll try to distill our conversation from earlier today: After taking a step back to think about this design more, my preference would to be to leverage the sparse nature of the histogram and to emit 32-bit hashes of the switches. That allows for a much simpler (and less invasive) implementation. The cost is that we have to maintain a hash-to-switch-name mapping in histograms.xml, which presumably requires some code to generate the mapping. However, based on our conversation, your preference is still to use a dense mapping, and to keep the unit test. In that case, I'll ask that you (1) Clean up the test code, including: (a) Separate out parsing the XML contents from the meat of the test. (b) Break the test up into multiple tests, e.g. one to verify that enum values are not reused, one to verify that the enum labels in histograms.xml are correct, etc. (2) Verify whether there are additional changes needed to use histograms.xml as a test input data file. Thanks. https://chromiumcodereview.appspot.com/344883002/diff/180001/chrome/browser/a... File chrome/browser/about_flags_unittest.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/180001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:17: #include "third_party/libxml/chromium/libxml_utils.h" FWIW, the Autofill code uses #include "third_party/libjingle/source/talk/xmllite/xmlparser.h" for XML parsing. I'm not sure which is simpler to use. https://chromiumcodereview.appspot.com/344883002/diff/240001/chrome/browser/a... File chrome/browser/about_flags.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/240001/chrome/browser/a... chrome/browser/about_flags.cc:2629: uma_histogram_hame, base::HistogramBase::kUmaTargetedHistogramFlag)); On 2014/07/22 14:25:05, alemate wrote: > On 2014/07/21 22:12:59, Ilya Sherman wrote: > > You're only adding a single histogram in this CL, right? Please continue to > use > > the macro to emit to the histogram, but just don't pass the name in as a > > parameter, i.e. use a literal instead. > > It would make this function ChromeOS-only, wouldn't it? > As far as I understood thestig@, whose idea was to move ReportCustomFlags from > chromeos:: to about_flags::, it should be less OS-specific. > > Maybe you could once introduce non-caching macros? I see that caching is not > used in UMA_HISTOGRAM_SPARSE_SLOWLY() macro, so, why don't we have these flags? I apologize, I forgot that the sparse histogram macro does not cache the histogram. Given that, it's fine to go back to using the macro, and keep the histogram name as a parameter to this method.
I like the less invasive approach. Why aren't we going with it? On Tue, Jul 22, 2014 at 1:37 PM, <isherman@chromium.org> wrote: > I'll try to distill our conversation from earlier today: > > After taking a step back to think about this design more, my preference > would to > be to leverage the sparse nature of the histogram and to emit 32-bit hashes > of > the switches. That allows for a much simpler (and less invasive) > implementation. The cost is that we have to maintain a hash-to-switch-name > mapping in histograms.xml, which presumably requires some code to generate > the > mapping. > > However, based on our conversation, your preference is still to use a dense > mapping, and to keep the unit test. In that case, I'll ask that you > (1) Clean up the test code, including: > (a) Separate out parsing the XML contents from the meat of the test. > (b) Break the test up into multiple tests, e.g. one to verify that > enum > values are not reused, one to verify that the enum labels in histograms.xml > are > correct, etc. > (2) Verify whether there are additional changes needed to use > histograms.xml > as a test input data file. > > Thanks. > > > https://chromiumcodereview.appspot.com/344883002/diff/180001/chrome/browser/a... > File chrome/browser/about_flags_unittest.cc (right): > > https://chromiumcodereview.appspot.com/344883002/diff/180001/chrome/browser/a... > chrome/browser/about_flags_unittest.cc:17: #include > "third_party/libxml/chromium/libxml_utils.h" > FWIW, the Autofill code uses #include > "third_party/libjingle/source/talk/xmllite/xmlparser.h" for XML parsing. > I'm not sure which is simpler to use. > > https://chromiumcodereview.appspot.com/344883002/diff/240001/chrome/browser/a... > File chrome/browser/about_flags.cc (right): > > https://chromiumcodereview.appspot.com/344883002/diff/240001/chrome/browser/a... > > chrome/browser/about_flags.cc:2629: uma_histogram_hame, > base::HistogramBase::kUmaTargetedHistogramFlag)); > On 2014/07/22 14:25:05, alemate wrote: >> >> On 2014/07/21 22:12:59, Ilya Sherman wrote: >> > You're only adding a single histogram in this CL, right? Please > > continue to >> >> use >> > the macro to emit to the histogram, but just don't pass the name in > > as a >> >> > parameter, i.e. use a literal instead. > > >> It would make this function ChromeOS-only, wouldn't it? >> As far as I understood thestig@, whose idea was to move > > ReportCustomFlags from >> >> chromeos:: to about_flags::, it should be less OS-specific. > > >> Maybe you could once introduce non-caching macros? I see that caching > > is not >> >> used in UMA_HISTOGRAM_SPARSE_SLOWLY() macro, so, why don't we have > > these flags? > > I apologize, I forgot that the sparse histogram macro does not cache the > histogram. Given that, it's fine to go back to using the macro, and > keep the histogram name as a parameter to this method. > > https://chromiumcodereview.appspot.com/344883002/ To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
+maruel for chrome/unit_tests.isolate On 2014/07/22 20:37:05, Ilya Sherman wrote: > I'll try to distill our conversation from earlier today: > > After taking a step back to think about this design more, my preference would to > be to leverage the sparse nature of the histogram and to emit 32-bit hashes of > the switches. That allows for a much simpler (and less invasive) > implementation. The cost is that we have to maintain a hash-to-switch-name > mapping in histograms.xml, which presumably requires some code to generate the > mapping. > > However, based on our conversation, your preference is still to use a dense > mapping, and to keep the unit test. In that case, I'll ask that you > (1) Clean up the test code, including: > (a) Separate out parsing the XML contents from the meat of the test. > (b) Break the test up into multiple tests, e.g. one to verify that enum > values are not reused, one to verify that the enum labels in histograms.xml are > correct, etc. > (2) Verify whether there are additional changes needed to use histograms.xml > as a test input data file. > > Thanks. Thank you for this list! Please review. https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/240001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2629: uma_histogram_hame, base::HistogramBase::kUmaTargetedHistogramFlag)); On 2014/07/22 20:37:05, Ilya Sherman wrote: > On 2014/07/22 14:25:05, alemate wrote: > > On 2014/07/21 22:12:59, Ilya Sherman wrote: > > > You're only adding a single histogram in this CL, right? Please continue to > > use > > > the macro to emit to the histogram, but just don't pass the name in as a > > > parameter, i.e. use a literal instead. > > > > It would make this function ChromeOS-only, wouldn't it? > > As far as I understood thestig@, whose idea was to move ReportCustomFlags from > > chromeos:: to about_flags::, it should be less OS-specific. > > > > Maybe you could once introduce non-caching macros? I see that caching is not > > used in UMA_HISTOGRAM_SPARSE_SLOWLY() macro, so, why don't we have these > flags? > > I apologize, I forgot that the sparse histogram macro does not cache the > histogram. Given that, it's fine to go back to using the macro, and keep the > histogram name as a parameter to this method. Done.
Did you see Scott's question (i.e. the comment immediately preceding yours)? I'll take a look at the details of your latest patch set later today, but please reply to that question in the meantime.
On 2014/07/22 21:22:44, sky wrote: > I like the less invasive approach. Why aren't we going with it? Sorry for the delayed answer. My point is that: to build histogram you need stable dense list of buckets. Otherwise it is problematic to compare new results with old, to understand what was added or removed between releases, etc. We can keep it either in chromium code or on server side. I think it is simpler to store it in chromium source, because all dependencies would be in a single repository. That is why I think it is important that we would have enum SwitchesUmaHistogramId in chromium code. This way adding or removing command-line switches would result in visible updates to UMA data. I also have a slender hope that the authors of new flags would think of its cost to ChromeOS user experience. There are several other differences in Ilya / me thoughts on the design of this feature (Ilya, please correct me if I am wrong): 1) Ilya didn't like the idea of reading histograms.xml in unit_test. Because this would be the first unit-test to parse histograms.xml, we do not have test code ready to parse it. And my CL #13 is not clear enough. On the other hand, histograms.xml is usually analyzed by precommit hooks, so we could add another checker there. From my point of view, there is a problem with about_flags.cc : there is no way to get the full lust of command-line switches used in about_flags.cc without compiling it. After chrome restart, we do not see flags. We need real command-line switches. Switches are duplicated there. Some have values. And moreover, parts of about_flags.cc are covered by #ifdefs, so it makes the analysis even more difficult. So my decision was to write unit test, which would test the real compiled binary and check that it exactly matches histograms.xml. And I still think that it is the most stable was to check the build result. So that I've updated unit test code to be more clear, and I'm ready to do further simplify it if you have more ideas. Another problem is that deletion and modification of switches cannot be fully covered by unit_test, because previous source is not available. This can be checked by precommit script. I've created it (see CL #13), but it is rather complicated, so it needs its own test. I think it is overkill for now, and I can verify changes to about_flags_switches_histogram_ids.h manually. I don't think there are going to be many updates to it, so it seems to me more easy to maintain that enum manually than 200 python lines (plus some test). Probably I'll add this precommit later, if it turns out to be simplier to maintain precommit ;-) . 2) Ilya's idea to emit hashes of the switches would simplify adding of new switches to about_flags.cc . In my CL switch must be added to: about_flags.cc about_flags_switches_histogram_ids.h (add new enum entry) chrome/browser/about_flags_unittest.cc (add switch text to the HistogramSwitchesOrdered[] ) tools/metrics/histograms/histograms.xml (add new enum entry) I think, that reporting hashes instead of indexes would drop the second line from this list (no more enum). But this would be at the cost of maintaining stable histogram bucket list outside of the chromium source. I think that keeping it here would simplify analysis and maintenance. As far as I know, we do not already have support of comparing two histograms in the UMA interface. We would either need to add this feature (and maintain it), or build comparison outside of UMA. It all seems to be more difficult than to maintain enum SwitchesUmaHistogramId. That is why I hope that we can have "enum SwitchesUmaHistogramId" in chromium code and unit test to verify mapping between command-line switches in about_flags.cc and strings in histograms.xml . It seems to me that presubmit code is overkill here, but may be your experience suggests something other. > On Tue, Jul 22, 2014 at 1:37 PM, <mailto:isherman@chromium.org> wrote: > > I'll try to distill our conversation from earlier today: > > > > After taking a step back to think about this design more, my preference > > would to > > be to leverage the sparse nature of the histogram and to emit 32-bit hashes > > of > > the switches. That allows for a much simpler (and less invasive) > > implementation. The cost is that we have to maintain a hash-to-switch-name > > mapping in histograms.xml, which presumably requires some code to generate > > the > > mapping. > > > > However, based on our conversation, your preference is still to use a dense > > mapping, and to keep the unit test. In that case, I'll ask that you > > (1) Clean up the test code, including: > > (a) Separate out parsing the XML contents from the meat of the test. > > (b) Break the test up into multiple tests, e.g. one to verify that > > enum > > values are not reused, one to verify that the enum labels in histograms.xml > > are > > correct, etc. > > (2) Verify whether there are additional changes needed to use > > histograms.xml > > as a test input data file. > > > > Thanks.
On 2014/07/28 23:41:38, alemate wrote: > On 2014/07/22 21:22:44, sky wrote: > > I like the less invasive approach. Why aren't we going with it? > > Sorry for the delayed answer. > > My point is that: to build histogram you need stable dense list of buckets. > Otherwise it is problematic to compare new results with old, to understand > what was added or removed between releases, etc. FWIW, I don't understand this concern. I agree that we want a stable list, which hashes provide. Why do we also need a dense one? > We can keep it either in chromium code or on server side. I think it is > simpler to store it in chromium source, because all dependencies would be in > a single repository. Regardless of whether the list is dense or sparse, it will be stored in histograms.xml, which lives in the Chromium repository. > > That is why I think it is important that we would have enum > SwitchesUmaHistogramId > in chromium code. This way adding or removing command-line switches would > result in visible updates to UMA data. I also have a slender hope that > the authors of new flags would think of its cost to ChromeOS user experience. > > There are several other differences in Ilya / me thoughts on the design of this > feature (Ilya, please correct me if I am wrong): > > 1) Ilya didn't like the idea of reading histograms.xml in unit_test. > Because this would be the first unit-test to parse histograms.xml, we do not > have > test code ready to parse it. And my CL #13 is not clear enough. > On the other hand, histograms.xml is usually analyzed by precommit hooks, so we > could add another checker there. > > From my point of view, there is a problem with about_flags.cc : there is no way > to get the full lust of command-line switches used in about_flags.cc without > compiling it. After chrome restart, we do not see flags. We need real > command-line > switches. Switches are duplicated there. Some have values. And moreover, > parts of about_flags.cc are covered by #ifdefs, so it makes the analysis even > more > difficult. > > So my decision was to write unit test, which would test the real compiled binary > and check that it exactly matches histograms.xml. And I still think that it is > the > most stable was to check the build result. > > So that I've updated unit test code to be more clear, and I'm ready to do > further > simplify it if you have more ideas. > > Another problem is that deletion and modification of switches cannot be fully > covered > by unit_test, because previous source is not available. This can be checked by > precommit script. I've created it (see CL #13), but it is rather complicated, so > it > needs its own test. I think it is overkill for now, and I can verify changes to > about_flags_switches_histogram_ids.h manually. I don't think there are going to > be > many updates to it, so it seems to me more easy to maintain that enum manually > than 200 python lines (plus some test). > > Probably I'll add this precommit later, if it turns out to be simplier to > maintain > precommit ;-) . > > 2) Ilya's idea to emit hashes of the switches would simplify adding of new > switches to about_flags.cc . > > In my CL switch must be added to: > about_flags.cc > about_flags_switches_histogram_ids.h (add new enum entry) > chrome/browser/about_flags_unittest.cc (add switch text to the > HistogramSwitchesOrdered[] ) > tools/metrics/histograms/histograms.xml (add new enum entry) > > I think, that reporting hashes instead of indexes would drop the second line > from > this list (no more enum). But this would be at the cost of maintaining stable > histogram > bucket list outside of the chromium source. I think that keeping it here would > simplify > analysis and maintenance. Firstly, if we use hashes, I see no reason to have the unit test be quite as complex -- the concern you raised about people associating the wrong enum item with a switch should no longer be relevant, since the code would programmatically choose which string to hash, and it could just choose the correct one. Secondly, as I mentioned above, histograms.xml would provide a stable bucket list within the Chromium repository. > As far as I know, we do not already have support of comparing two histograms in > the UMA > interface. We would either need to add this feature (and maintain it), or build > comparison > outside of UMA. It all seems to be more difficult than to maintain enum > SwitchesUmaHistogramId. We do have some functionality along these lines. If you were planning to write manual scripts rather than using the dashboards, I'd recommend emailing uma-team@ about your usecase. I think there's a good chance that the dashboards would provide, via existing functionality, the tools that you need. > That is why I hope that we can have "enum SwitchesUmaHistogramId" in chromium > code and > unit test to verify mapping between command-line switches in about_flags.cc and > strings > in histograms.xml . It seems to me that presubmit code is overkill here, but may > be your > experience suggests something other. > > > > On Tue, Jul 22, 2014 at 1:37 PM, <mailto:isherman@chromium.org> wrote: > > > I'll try to distill our conversation from earlier today: > > > > > > After taking a step back to think about this design more, my preference > > > would to > > > be to leverage the sparse nature of the histogram and to emit 32-bit hashes > > > of > > > the switches. That allows for a much simpler (and less invasive) > > > implementation. The cost is that we have to maintain a hash-to-switch-name > > > mapping in histograms.xml, which presumably requires some code to generate > > > the > > > mapping. > > > > > > However, based on our conversation, your preference is still to use a dense > > > mapping, and to keep the unit test. In that case, I'll ask that you > > > (1) Clean up the test code, including: > > > (a) Separate out parsing the XML contents from the meat of the test. > > > (b) Break the test up into multiple tests, e.g. one to verify that > > > enum > > > values are not reused, one to verify that the enum labels in histograms.xml > > > are > > > correct, etc. > > > (2) Verify whether there are additional changes needed to use > > > histograms.xml > > > as a test input data file. > > > > > > Thanks.
On 2014/07/28 22:47:31, Ilya Sherman wrote: > Did you see Scott's question (i.e. the comment immediately preceding yours)? Yes, it just took me a while to write an answer. > I'll take a look at the details of your latest patch set later today, but please > reply to that question in the meantime.
On 2014/07/28 23:57:08, Ilya Sherman wrote: > On 2014/07/28 23:41:38, alemate wrote: > > On 2014/07/22 21:22:44, sky wrote: > > > I like the less invasive approach. Why aren't we going with it? > > > > Sorry for the delayed answer. > > > > My point is that: to build histogram you need stable dense list of buckets. > > Otherwise it is problematic to compare new results with old, to understand > > what was added or removed between releases, etc. > > FWIW, I don't understand this concern. I agree that we want a stable list, > which hashes provide. Why do we also need a dense one? Consider two histograms: 1) X X X X X X 1 3 5 2) X X X X 2 5 6 To compare them we need to convert both of them to the set (1,2,3,5,6). The question is whether it will be stored in chromium source, or in some external system. It seems that it is easier (for me) to maintain this list in chromium source. Of course, it would be great if some other person would create and maintain that external system ;-) > > We can keep it either in chromium code or on server side. I think it is > > simpler to store it in chromium source, because all dependencies would be in > > a single repository. > > Regardless of whether the list is dense or sparse, it will be stored in > histograms.xml, which lives in the Chromium repository. > > > > > That is why I think it is important that we would have enum > > SwitchesUmaHistogramId > > in chromium code. This way adding or removing command-line switches would > > result in visible updates to UMA data. I also have a slender hope that > > the authors of new flags would think of its cost to ChromeOS user experience. > > > > There are several other differences in Ilya / me thoughts on the design of > this > > feature (Ilya, please correct me if I am wrong): > > > > 1) Ilya didn't like the idea of reading histograms.xml in unit_test. > > Because this would be the first unit-test to parse histograms.xml, we do not > > have > > test code ready to parse it. And my CL #13 is not clear enough. > > On the other hand, histograms.xml is usually analyzed by precommit hooks, so > we > > could add another checker there. > > > > From my point of view, there is a problem with about_flags.cc : there is no > way > > to get the full lust of command-line switches used in about_flags.cc without > > compiling it. After chrome restart, we do not see flags. We need real > > command-line > > switches. Switches are duplicated there. Some have values. And moreover, > > parts of about_flags.cc are covered by #ifdefs, so it makes the analysis even > > more > > difficult. > > > > So my decision was to write unit test, which would test the real compiled > binary > > and check that it exactly matches histograms.xml. And I still think that it is > > the > > most stable was to check the build result. > > > > So that I've updated unit test code to be more clear, and I'm ready to do > > further > > simplify it if you have more ideas. > > > > Another problem is that deletion and modification of switches cannot be fully > > covered > > by unit_test, because previous source is not available. This can be checked by > > precommit script. I've created it (see CL #13), but it is rather complicated, > so > > it > > needs its own test. I think it is overkill for now, and I can verify changes > to > > about_flags_switches_histogram_ids.h manually. I don't think there are going > to > > be > > many updates to it, so it seems to me more easy to maintain that enum manually > > than 200 python lines (plus some test). > > > > Probably I'll add this precommit later, if it turns out to be simplier to > > maintain > > precommit ;-) . > > > > 2) Ilya's idea to emit hashes of the switches would simplify adding of new > > switches to about_flags.cc . > > > > In my CL switch must be added to: > > about_flags.cc > > about_flags_switches_histogram_ids.h (add new enum entry) > > chrome/browser/about_flags_unittest.cc (add switch text to the > > HistogramSwitchesOrdered[] ) > > tools/metrics/histograms/histograms.xml (add new enum entry) > > > > I think, that reporting hashes instead of indexes would drop the second line > > from > > this list (no more enum). But this would be at the cost of maintaining stable > > histogram > > bucket list outside of the chromium source. I think that keeping it here would > > simplify > > analysis and maintenance. > > Firstly, if we use hashes, I see no reason to have the unit test be quite as > complex -- the concern you raised about people associating the wrong enum item > with a switch should no longer be relevant, since the code would > programmatically choose which string to hash, and it could just choose the > correct one. We would still need to verify that all switches from about_flags.cc are found in histograms.xml. Due to complexity of about_flags we need to compile it to get the list. We could drop the list of strings from unit test as the cost of having precommit hook. But dropping unit test would make mapping unstable. > Secondly, as I mentioned above, histograms.xml would provide a stable bucket > list within the Chromium repository. Yes, if we would have precommit hook. > > As far as I know, we do not already have support of comparing two histograms > in > > the UMA > > interface. We would either need to add this feature (and maintain it), or > build > > comparison > > outside of UMA. It all seems to be more difficult than to maintain enum > > SwitchesUmaHistogramId. > > We do have some functionality along these lines. If you were planning to write > manual scripts rather than using the dashboards, I'd recommend emailing > uma-team@ about your usecase. I think there's a good chance that the dashboards > would provide, via existing functionality, the tools that you need. As far as I know, they strongly suggest to build results on the chromium side as close to the needed report format as possible. Because it reduces load at our side. > > That is why I hope that we can have "enum SwitchesUmaHistogramId" in chromium > > code and > > unit test to verify mapping between command-line switches in about_flags.cc > and > > strings > > in histograms.xml . It seems to me that presubmit code is overkill here, but > may > > be your > > experience suggests something other. > > > > > > > On Tue, Jul 22, 2014 at 1:37 PM, <mailto:isherman@chromium.org> wrote: > > > > I'll try to distill our conversation from earlier today: > > > > > > > > After taking a step back to think about this design more, my preference > > > > would to > > > > be to leverage the sparse nature of the histogram and to emit 32-bit > hashes > > > > of > > > > the switches. That allows for a much simpler (and less invasive) > > > > implementation. The cost is that we have to maintain a > hash-to-switch-name > > > > mapping in histograms.xml, which presumably requires some code to generate > > > > the > > > > mapping. > > > > > > > > However, based on our conversation, your preference is still to use a > dense > > > > mapping, and to keep the unit test. In that case, I'll ask that you > > > > (1) Clean up the test code, including: > > > > (a) Separate out parsing the XML contents from the meat of the test. > > > > (b) Break the test up into multiple tests, e.g. one to verify that > > > > enum > > > > values are not reused, one to verify that the enum labels in > histograms.xml > > > > are > > > > correct, etc. > > > > (2) Verify whether there are additional changes needed to use > > > > histograms.xml > > > > as a test input data file. > > > > > > > > Thanks.
On 2014/07/29 00:25:54, alemate wrote: > On 2014/07/28 23:57:08, Ilya Sherman wrote: > > On 2014/07/28 23:41:38, alemate wrote: > > > On 2014/07/22 21:22:44, sky wrote: > > > > I like the less invasive approach. Why aren't we going with it? > > > > > > Sorry for the delayed answer. > > > > > > My point is that: to build histogram you need stable dense list of buckets. > > > Otherwise it is problematic to compare new results with old, to understand > > > what was added or removed between releases, etc. > > > > FWIW, I don't understand this concern. I agree that we want a stable list, > > which hashes provide. Why do we also need a dense one? > > Consider two histograms: > > 1) > X > X X > X X X > 1 3 5 > > 2) > > X > X X X > 2 5 6 > > To compare them we need to convert both of them to the set (1,2,3,5,6). I still don't understand what this means. The two histograms are equally accurately represented as below, and in this representation, they are clearly trivially easy to merge or compare. The human-readable labels assigned to buckets have nothing to do with the algorithms for comparing the histograms themselves. 1) X X X X X X 1 2 3 4 5 6 2) X X X X 1 2 3 4 5 6 > The question is whether it will be stored in chromium source, or > in some external system. > > It seems that it is easier (for me) to maintain this list in chromium source. > Of course, it would be great if some other person would create and maintain that > external system ;-) > > > > > We can keep it either in chromium code or on server side. I think it is > > > simpler to store it in chromium source, because all dependencies would be in > > > a single repository. > > > > Regardless of whether the list is dense or sparse, it will be stored in > > histograms.xml, which lives in the Chromium repository. > > > > > > > > That is why I think it is important that we would have enum > > > SwitchesUmaHistogramId > > > in chromium code. This way adding or removing command-line switches would > > > result in visible updates to UMA data. I also have a slender hope that > > > the authors of new flags would think of its cost to ChromeOS user > experience. > > > > > > There are several other differences in Ilya / me thoughts on the design of > > this > > > feature (Ilya, please correct me if I am wrong): > > > > > > 1) Ilya didn't like the idea of reading histograms.xml in unit_test. > > > Because this would be the first unit-test to parse histograms.xml, we do not > > > have > > > test code ready to parse it. And my CL #13 is not clear enough. > > > On the other hand, histograms.xml is usually analyzed by precommit hooks, so > > we > > > could add another checker there. > > > > > > From my point of view, there is a problem with about_flags.cc : there is no > > way > > > to get the full lust of command-line switches used in about_flags.cc without > > > compiling it. After chrome restart, we do not see flags. We need real > > > command-line > > > switches. Switches are duplicated there. Some have values. And moreover, > > > parts of about_flags.cc are covered by #ifdefs, so it makes the analysis > even > > > more > > > difficult. > > > > > > So my decision was to write unit test, which would test the real compiled > > binary > > > and check that it exactly matches histograms.xml. And I still think that it > is > > > the > > > most stable was to check the build result. > > > > > > So that I've updated unit test code to be more clear, and I'm ready to do > > > further > > > simplify it if you have more ideas. > > > > > > Another problem is that deletion and modification of switches cannot be > fully > > > covered > > > by unit_test, because previous source is not available. This can be checked > by > > > precommit script. I've created it (see CL #13), but it is rather > complicated, > > so > > > it > > > needs its own test. I think it is overkill for now, and I can verify changes > > to > > > about_flags_switches_histogram_ids.h manually. I don't think there are going > > to > > > be > > > many updates to it, so it seems to me more easy to maintain that enum > manually > > > than 200 python lines (plus some test). > > > > > > Probably I'll add this precommit later, if it turns out to be simplier to > > > maintain > > > precommit ;-) . > > > > > > 2) Ilya's idea to emit hashes of the switches would simplify adding of new > > > switches to about_flags.cc . > > > > > > In my CL switch must be added to: > > > about_flags.cc > > > about_flags_switches_histogram_ids.h (add new enum entry) > > > chrome/browser/about_flags_unittest.cc (add switch text to the > > > HistogramSwitchesOrdered[] ) > > > tools/metrics/histograms/histograms.xml (add new enum entry) > > > > > > I think, that reporting hashes instead of indexes would drop the second line > > > from > > > this list (no more enum). But this would be at the cost of maintaining > stable > > > histogram > > > bucket list outside of the chromium source. I think that keeping it here > would > > > simplify > > > analysis and maintenance. > > > > Firstly, if we use hashes, I see no reason to have the unit test be quite as > > complex -- the concern you raised about people associating the wrong enum item > > with a switch should no longer be relevant, since the code would > > programmatically choose which string to hash, and it could just choose the > > correct one. > > We would still need to verify that all switches from about_flags.cc are found in > histograms.xml. Due to complexity of about_flags we need to compile it to get > the list. > > We could drop the list of strings from unit test as the cost of having precommit > hook. > But dropping unit test would make mapping unstable. Perhaps you mean something different by "unstable". I take "stable" to mean that the flag "--enable-feature-foo" will always map to hash 0xDEADBEEF. That has nothing to do with mapping 0xDEADBEEF back to "--enable-feature-foo" in histograms.xml. As far as updating histograms.xml goes, I agree that we'd want some automated way to do so. However, I'm not convinced that a unit test would be the most appropriate option if we're hashing strings. Even if we do leave it as a unit test, I'd lean toward not hardcoding the list of flags, since the test would actually be more robust if it would just automatically check every flag available on the platform it's being run on. > > Secondly, as I mentioned above, histograms.xml would provide a stable bucket > > list within the Chromium repository. > > Yes, if we would have precommit hook. > > > > > As far as I know, we do not already have support of comparing two histograms > > in > > > the UMA > > > interface. We would either need to add this feature (and maintain it), or > > build > > > comparison > > > outside of UMA. It all seems to be more difficult than to maintain enum > > > SwitchesUmaHistogramId. > > > > We do have some functionality along these lines. If you were planning to > write > > manual scripts rather than using the dashboards, I'd recommend emailing > > uma-team@ about your usecase. I think there's a good chance that the > dashboards > > would provide, via existing functionality, the tools that you need. > > As far as I know, they strongly suggest to build results on the chromium side > as close to the needed report format as possible. Because it reduces load > at our side. Why does your report format need to have dense buckets? Wouldn't you prefer the report format to have human-readable strings, and therefore be agnostic to the invisible machine representation that's used in the backend? This seems like a conversation that might be better to continue on the uma-team@ mailing list. > > > That is why I hope that we can have "enum SwitchesUmaHistogramId" in > chromium > > > code and > > > unit test to verify mapping between command-line switches in about_flags.cc > > and > > > strings > > > in histograms.xml . It seems to me that presubmit code is overkill here, but > > may > > > be your > > > experience suggests something other. > > > > > > > > > > On Tue, Jul 22, 2014 at 1:37 PM, <mailto:isherman@chromium.org> wrote: > > > > > I'll try to distill our conversation from earlier today: > > > > > > > > > > After taking a step back to think about this design more, my preference > > > > > would to > > > > > be to leverage the sparse nature of the histogram and to emit 32-bit > > hashes > > > > > of > > > > > the switches. That allows for a much simpler (and less invasive) > > > > > implementation. The cost is that we have to maintain a > > hash-to-switch-name > > > > > mapping in histograms.xml, which presumably requires some code to > generate > > > > > the > > > > > mapping. > > > > > > > > > > However, based on our conversation, your preference is still to use a > > dense > > > > > mapping, and to keep the unit test. In that case, I'll ask that you > > > > > (1) Clean up the test code, including: > > > > > (a) Separate out parsing the XML contents from the meat of the > test. > > > > > (b) Break the test up into multiple tests, e.g. one to verify that > > > > > enum > > > > > values are not reused, one to verify that the enum labels in > > histograms.xml > > > > > are > > > > > correct, etc. > > > > > (2) Verify whether there are additional changes needed to use > > > > > histograms.xml > > > > > as a test input data file. > > > > > > > > > > Thanks.
W.r.t. the code if you keep the current approach: https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... File chrome/browser/about_flags_unittest.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:402: for (SwitchesHistogramIDs::const_iterator i = switch_histogram_id.begin(); nit: Please use "it" or "iter" for generic iterator names; "i" makes the reader think of an integer variable. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:414: } else { nit: Please add ASSERT_EQ(id, histogram_id_to_switch_.size()); https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:439: ScopedVector<std::string> histogram_id_to_switch_; Why is this a ScopedVector, rather than just a regular vector; or better yet, a map? https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:549: const std::string kDD("--"); nit: Please name this something like "kDoubleDash" rather than the cryptic "kDD" plus a comment. In general, if you find yourself needing to write a comment to explain a variable name, you should probably name the variable more clearly instead. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:807: EXPECT_STREQ("", histogram_id_to_switch_[0]->c_str()); nit: Prefer std::string() to "" https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:809: EXPECT_FALSE(histogram_id_to_switch_[2]); /* RESERVED2 */ Why is this RESERVED2 rather than RESERVED1? https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:811: EXPECT_FALSE(histogram_id_to_switch_[4]); /* RESERVED4 */ Please assert that the array size is at least 5, since you index into it to at least there. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:818: << histogram_id_to_switch_[i]->c_str() nit: No need for c_str(). https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:836: // Returns empty map on error. Please expand this comment to be more detailed. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:837: std::map<int, std::string> ParseEnumFromHistogramsXml( Please move helper functions into the anonymous namespace. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:843: bool success = true; It looks like you can entirely replace this with early return statements, which IMO would be clearer (as well as briefer). https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:856: << entries_index << "): No 'value' attribute."; Did you mean to use an EXPECT_ or ASSERT_ statement? Tests shouldn't print output that isn't testing assertions. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:920: break; Please document what these four control statements are doing. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:942: .AppendASCII("histograms.xml"); nit: I don't think this formatting is quite right -- the continued lines should be indented a total of six spaces, rather than 33. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:968: for (std::map<int, std::string>::reverse_iterator ri = Again, please use "it" or "iter" for the iterator name.
.isolate lgtm https://codereview.chromium.org/344883002/diff/300001/chrome/unit_tests.isolate File chrome/unit_tests.isolate (right): https://codereview.chromium.org/344883002/diff/300001/chrome/unit_tests.isola... chrome/unit_tests.isolate:17: '../tools/metrics/histograms/histograms.xml', It's needed in android too?
On 2014/07/29 00:50:06, Ilya Sherman wrote: > On 2014/07/29 00:25:54, alemate wrote: > > On 2014/07/28 23:57:08, Ilya Sherman wrote: > > > On 2014/07/28 23:41:38, alemate wrote: > > > > On 2014/07/22 21:22:44, sky wrote: > > > > > I like the less invasive approach. Why aren't we going with it? > > > > > > > > Sorry for the delayed answer. > > > > > > > > My point is that: to build histogram you need stable dense list of > buckets. > > > > Otherwise it is problematic to compare new results with old, to understand > > > > what was added or removed between releases, etc. > > > > > > FWIW, I don't understand this concern. I agree that we want a stable list, > > > which hashes provide. Why do we also need a dense one? > > > > Consider two histograms: > > > > 1) > > X > > X X > > X X X > > 1 3 5 > > > > 2) > > > > X > > X X X > > 2 5 6 > > > > To compare them we need to convert both of them to the set (1,2,3,5,6). > > I still don't understand what this means. The two histograms are equally > accurately represented as below, and in this representation, they are clearly > trivially easy to merge or compare. The human-readable labels assigned to > buckets have nothing to do with the algorithms for comparing the histograms > themselves. > > 1) > X > X X > X X X > 1 2 3 4 5 6 > > 2) > > X > X X X > 1 2 3 4 5 6 > > > The question is whether it will be stored in chromium source, or > > in some external system. > > > > It seems that it is easier (for me) to maintain this list in chromium source. > > Of course, it would be great if some other person would create and maintain > that > > external system ;-) > > > > > > > > We can keep it either in chromium code or on server side. I think it is > > > > simpler to store it in chromium source, because all dependencies would be > in > > > > a single repository. > > > > > > Regardless of whether the list is dense or sparse, it will be stored in > > > histograms.xml, which lives in the Chromium repository. > > > > > > > > > > > That is why I think it is important that we would have enum > > > > SwitchesUmaHistogramId > > > > in chromium code. This way adding or removing command-line switches would > > > > result in visible updates to UMA data. I also have a slender hope that > > > > the authors of new flags would think of its cost to ChromeOS user > > experience. > > > > > > > > There are several other differences in Ilya / me thoughts on the design of > > > this > > > > feature (Ilya, please correct me if I am wrong): > > > > > > > > 1) Ilya didn't like the idea of reading histograms.xml in unit_test. > > > > Because this would be the first unit-test to parse histograms.xml, we do > not > > > > have > > > > test code ready to parse it. And my CL #13 is not clear enough. > > > > On the other hand, histograms.xml is usually analyzed by precommit hooks, > so > > > we > > > > could add another checker there. > > > > > > > > From my point of view, there is a problem with about_flags.cc : there is > no > > > way > > > > to get the full lust of command-line switches used in about_flags.cc > without > > > > compiling it. After chrome restart, we do not see flags. We need real > > > > command-line > > > > switches. Switches are duplicated there. Some have values. And moreover, > > > > parts of about_flags.cc are covered by #ifdefs, so it makes the analysis > > even > > > > more > > > > difficult. > > > > > > > > So my decision was to write unit test, which would test the real compiled > > > binary > > > > and check that it exactly matches histograms.xml. And I still think that > it > > is > > > > the > > > > most stable was to check the build result. > > > > > > > > So that I've updated unit test code to be more clear, and I'm ready to do > > > > further > > > > simplify it if you have more ideas. > > > > > > > > Another problem is that deletion and modification of switches cannot be > > fully > > > > covered > > > > by unit_test, because previous source is not available. This can be > checked > > by > > > > precommit script. I've created it (see CL #13), but it is rather > > complicated, > > > so > > > > it > > > > needs its own test. I think it is overkill for now, and I can verify > changes > > > to > > > > about_flags_switches_histogram_ids.h manually. I don't think there are > going > > > to > > > > be > > > > many updates to it, so it seems to me more easy to maintain that enum > > manually > > > > than 200 python lines (plus some test). > > > > > > > > Probably I'll add this precommit later, if it turns out to be simplier to > > > > maintain > > > > precommit ;-) . > > > > > > > > 2) Ilya's idea to emit hashes of the switches would simplify adding of new > > > > switches to about_flags.cc . > > > > > > > > In my CL switch must be added to: > > > > about_flags.cc > > > > about_flags_switches_histogram_ids.h (add new enum entry) > > > > chrome/browser/about_flags_unittest.cc (add switch text to the > > > > HistogramSwitchesOrdered[] ) > > > > tools/metrics/histograms/histograms.xml (add new enum entry) > > > > > > > > I think, that reporting hashes instead of indexes would drop the second > line > > > > from > > > > this list (no more enum). But this would be at the cost of maintaining > > stable > > > > histogram > > > > bucket list outside of the chromium source. I think that keeping it here > > would > > > > simplify > > > > analysis and maintenance. > > > > > > Firstly, if we use hashes, I see no reason to have the unit test be quite as > > > complex -- the concern you raised about people associating the wrong enum > item > > > with a switch should no longer be relevant, since the code would > > > programmatically choose which string to hash, and it could just choose the > > > correct one. > > > > We would still need to verify that all switches from about_flags.cc are found > in > > histograms.xml. Due to complexity of about_flags we need to compile it to get > > the list. > > > > We could drop the list of strings from unit test as the cost of having > precommit > > hook. > > But dropping unit test would make mapping unstable. > > Perhaps you mean something different by "unstable". I take "stable" to mean > that the flag "--enable-feature-foo" will always map to hash 0xDEADBEEF. That > has nothing to do with mapping 0xDEADBEEF back to "--enable-feature-foo" in > histograms.xml. For me the expected result here is histogram. And "stability" is to be able to store one histogram image, then another one a year later, put them on the same page and be able to visually compare them. That is why I am trying to build the final result here and never depend on external teams. > As far as updating histograms.xml goes, I agree that we'd want some automated > way to do so. However, I'm not convinced that a unit test would be the most > appropriate option if we're hashing strings. Even if we do leave it as a unit > test, I'd lean toward not hardcoding the list of flags, since the test would > actually be more robust if it would just automatically check every flag > available on the platform it's being run on. The fact that list of strings in about_flags.cc is needed (or is not needed) doesn't depend on the type of bucket ID we use. I've added it just to be sure that the person, who would modify histograms.xml, would have to modify some exemplary list (which doesn't depend on #ifdef's) . Just to be sure he would read explanations around. We can drop that list right now, but I would better leave it just to have one more check here. > > > Secondly, as I mentioned above, histograms.xml would provide a stable bucket > > > list within the Chromium repository. > > > > Yes, if we would have precommit hook. > > > > > > > > As far as I know, we do not already have support of comparing two > histograms > > > in > > > > the UMA > > > > interface. We would either need to add this feature (and maintain it), or > > > build > > > > comparison > > > > outside of UMA. It all seems to be more difficult than to maintain enum > > > > SwitchesUmaHistogramId. > > > > > > We do have some functionality along these lines. If you were planning to > > write > > > manual scripts rather than using the dashboards, I'd recommend emailing > > > uma-team@ about your usecase. I think there's a good chance that the > > dashboards > > > would provide, via existing functionality, the tools that you need. > > > > As far as I know, they strongly suggest to build results on the chromium side > > as close to the needed report format as possible. Because it reduces load > > at our side. > > Why does your report format need to have dense buckets? Wouldn't you prefer the > report format to have human-readable strings, and therefore be agnostic to the > invisible machine representation that's used in the backend? This seems like a > conversation that might be better to continue on the uma-team@ mailing list. I had conversations with them a few times, and expect current approach to be much faster and reliable way to get the result.
https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... File chrome/browser/about_flags_unittest.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:402: for (SwitchesHistogramIDs::const_iterator i = switch_histogram_id.begin(); On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: Please use "it" or "iter" for generic iterator names; "i" makes the reader > think of an integer variable. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:414: } else { On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: Please add ASSERT_EQ(id, histogram_id_to_switch_.size()); The order of IDs in about_flags is undefined, so it is not right. (and some IDs might be missing) https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:439: ScopedVector<std::string> histogram_id_to_switch_; On 2014/07/29 07:16:45, Ilya Sherman wrote: > Why is this a ScopedVector, rather than just a regular vector; > or better yet, a map? This is scoped vector to store the special value "unused", which usually means that this is an ID of switch under #ifdef . Or may be a deprecated switch. This can be a map, but it is simplier to check that value exists. (i.e. you do not need to use lower_bound() and check iterators). https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:549: const std::string kDD("--"); On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: Please name this something like "kDoubleDash" rather than the cryptic "kDD" > plus a comment. In general, if you find yourself needing to write a comment to > explain a variable name, you should probably name the variable more clearly > instead. Yes, you're right. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:807: EXPECT_STREQ("", histogram_id_to_switch_[0]->c_str()); On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: Prefer std::string() to "" Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:809: EXPECT_FALSE(histogram_id_to_switch_[2]); /* RESERVED2 */ On 2014/07/29 07:16:45, Ilya Sherman wrote: > Why is this RESERVED2 rather than RESERVED1? The idea was to reflect index in constant name. But I'm OK to rename it. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:811: EXPECT_FALSE(histogram_id_to_switch_[4]); /* RESERVED4 */ On 2014/07/29 07:16:45, Ilya Sherman wrote: > Please assert that the array size is at least 5, since you index into it to at > least there. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:818: << histogram_id_to_switch_[i]->c_str() On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: No need for c_str(). This is because of ScopedVector . https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:836: // Returns empty map on error. On 2014/07/29 07:16:45, Ilya Sherman wrote: > Please expand this comment to be more detailed. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:837: std::map<int, std::string> ParseEnumFromHistogramsXml( On 2014/07/29 07:16:45, Ilya Sherman wrote: > Please move helper functions into the anonymous namespace. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:843: bool success = true; On 2014/07/29 07:16:45, Ilya Sherman wrote: > It looks like you can entirely replace this with early return statements, which > IMO would be clearer (as well as briefer). This is to report maximum number of errors on a single run (not to stop on the first one). https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:856: << entries_index << "): No 'value' attribute."; On 2014/07/29 07:16:45, Ilya Sherman wrote: > Did you mean to use an EXPECT_ or ASSERT_ statement? Tests shouldn't print > output that isn't testing assertions. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:920: break; On 2014/07/29 07:16:45, Ilya Sherman wrote: > Please document what these four control statements are doing. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:942: .AppendASCII("histograms.xml"); On 2014/07/29 07:16:45, Ilya Sherman wrote: > nit: I don't think this formatting is quite right -- the continued lines should > be indented a total of six spaces, rather than 33. This is really strange, but it is a result of clang-format. Set to 6 spaces manually. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:968: for (std::map<int, std::string>::reverse_iterator ri = On 2014/07/29 07:16:45, Ilya Sherman wrote: > Again, please use "it" or "iter" for the iterator name. Done. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/unit_test... File chrome/unit_tests.isolate (right): https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/unit_test... chrome/unit_tests.isolate:17: '../tools/metrics/histograms/histograms.xml', On 2014/07/29 19:19:41, M-A Ruel wrote: > It's needed in android too? If AboutFlagsTest unittest is run on android is is also needed. The idea is to check global flags consistency.
On 2014/07/31 00:17:53, alemate wrote: > For me the expected result here is histogram. And "stability" is to be able to > store one histogram image, then another one a year later, put them on the same > page and be able to visually compare them. You'd be able to do that with a sparse histogram. > That is why I am trying to build the final result here and never depend on > external > teams. What do you mean by "external"? I assume that you're planning to look at data uploaded to the UMA server, which means that you're depending on the UMA team (which I wouldn't really describe as an external team; UMA Is a core part of the Chrome infrastructure). I'm not following what dependency you're trying to avoid. > The fact that list of strings in about_flags.cc is needed (or is not needed) > doesn't depend on the type of bucket ID we use. I've added it just to be sure > that the person, who would modify histograms.xml, would have to modify some > exemplary list (which doesn't depend on #ifdef's) . Just to be sure he would > read explanations around. If the histograms.xml values are hashes, then why make the author read long explanations somewhere? Just provide a script that the author can run to update histograms.xml, and you're done. > > Why does your report format need to have dense buckets? Wouldn't you prefer > the > > report format to have human-readable strings, and therefore be agnostic to the > > invisible machine representation that's used in the backend? This seems like > a > > conversation that might be better to continue on the uma-team@ mailing list. > > I had conversations with them a few times, and expect current approach to be > much > faster and reliable way to get the result. Who are "they"? I don't remember seeing any such conversations, and I'm on the uma-team@ mailing list.
https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... File chrome/browser/about_flags_unittest.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:414: } else { On 2014/07/31 00:18:08, alemate wrote: > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > nit: Please add ASSERT_EQ(id, histogram_id_to_switch_.size()); > > The order of IDs in about_flags is undefined, so it is not right. > (and some IDs might be missing) In that case, it really sounds like you ought to use a map. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:439: ScopedVector<std::string> histogram_id_to_switch_; On 2014/07/31 00:18:08, alemate wrote: > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > Why is this a ScopedVector, rather than just a regular vector; > > or better yet, a map? > > This is scoped vector to store the special value "unused", which usually means > that this is an ID of switch under #ifdef . Or may be a deprecated switch. > > This can be a map, but it is simplier to check that value exists. (i.e. you do > not need to use lower_bound() and check iterators). Checking whether a value exists in a map is easy: my_map.count(value). That's also much clearer than having special/magic "unused" values. https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:818: << histogram_id_to_switch_[i]->c_str() On 2014/07/31 00:18:08, alemate wrote: > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > nit: No need for c_str(). > > This is because of ScopedVector . I don't understand -- why does a ScopedVector require you to use c_str()? What's wrong with accessing the string value in the vector directly, i.e. "*histogram_id_to_switch_[i]"? https://chromiumcodereview.appspot.com/344883002/diff/320001/chrome/browser/a... File chrome/browser/about_flags_unittest.cc (right): https://chromiumcodereview.appspot.com/344883002/diff/320001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:43: XmlReader& reader); Please define the function here, rather than forward-declaring it. https://chromiumcodereview.appspot.com/344883002/diff/320001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:56: XmlReader& histograms_xml) { nit: Variables should be passed either by const-reference or by pointer; pretty much never by reference. https://chromiumcodereview.appspot.com/344883002/diff/320001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:59: // Implement simple DFS. nit: "DFS" -> "depth first search" https://chromiumcodereview.appspot.com/344883002/diff/320001/chrome/browser/a... chrome/browser/about_flags_unittest.cc:116: XmlReader& reader) { Ditto.
On 2014/07/31 00:37:52, Ilya Sherman wrote: > https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... > File chrome/browser/about_flags_unittest.cc (right): > > https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... > chrome/browser/about_flags_unittest.cc:414: } else { > On 2014/07/31 00:18:08, alemate wrote: > > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > > nit: Please add ASSERT_EQ(id, histogram_id_to_switch_.size()); > > > > The order of IDs in about_flags is undefined, so it is not right. > > (and some IDs might be missing) > > In that case, it really sounds like you ought to use a map. But the order of IDs in enum and in histograms.xml is strict. So it seems easier to compute maps difference between two maps when one of them is implemented as array. When iterating you get all missing nodes for free. And array implementation is also free here, as the map is dense. > > https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... > chrome/browser/about_flags_unittest.cc:439: ScopedVector<std::string> > histogram_id_to_switch_; > On 2014/07/31 00:18:08, alemate wrote: > > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > > Why is this a ScopedVector, rather than just a regular vector; > > > or better yet, a map? > > > > This is scoped vector to store the special value "unused", which usually means > > that this is an ID of switch under #ifdef . Or may be a deprecated switch. > > > > This can be a map, but it is simplier to check that value exists. (i.e. you do > > not need to use lower_bound() and check iterators). > > Checking whether a value exists in a map is easy: my_map.count(value). That's > also much clearer than having special/magic "unused" values. > > https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/browser/a... > chrome/browser/about_flags_unittest.cc:818: << > histogram_id_to_switch_[i]->c_str() > On 2014/07/31 00:18:08, alemate wrote: > > On 2014/07/29 07:16:45, Ilya Sherman wrote: > > > nit: No need for c_str(). > > > > This is because of ScopedVector . > > I don't understand -- why does a ScopedVector require you to use c_str()? > What's wrong with accessing the string value in the vector directly, i.e. > "*histogram_id_to_switch_[i]"? Yes, you're right. Done. https://codereview.chromium.org/344883002/diff/320001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/320001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:43: XmlReader& reader); On 2014/07/31 00:37:51, Ilya Sherman wrote: > Please define the function here, rather than forward-declaring it. Done. https://codereview.chromium.org/344883002/diff/320001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:56: XmlReader& histograms_xml) { On 2014/07/31 00:37:51, Ilya Sherman wrote: > nit: Variables should be passed either by const-reference or by pointer; pretty > much never by reference. Done. https://codereview.chromium.org/344883002/diff/320001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:59: // Implement simple DFS. On 2014/07/31 00:37:51, Ilya Sherman wrote: > nit: "DFS" -> "depth first search" Done. https://codereview.chromium.org/344883002/diff/320001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:116: XmlReader& reader) { On 2014/07/31 00:37:51, Ilya Sherman wrote: > Ditto. Done.
https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/unit_test... File chrome/unit_tests.isolate (right): https://chromiumcodereview.appspot.com/344883002/diff/300001/chrome/unit_test... chrome/unit_tests.isolate:17: '../tools/metrics/histograms/histograms.xml', On 2014/07/31 00:18:08, alemate wrote: > On 2014/07/29 19:19:41, M-A Ruel wrote: > > It's needed in android too? > > If AboutFlagsTest unittest is run on android is is also needed. > The idea is to check global flags consistency. Good.
I've updated CL to report hashes. Please review.
https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1522: UMA_HISTOGRAM_ID_kEnableAccessibilityTabSwitcher) Why are you doing this change? https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:25: // This value is reported as swtich histogram ID if switch name has unknown swtich->switch https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:171: // Returns commans-line switch UMA ID, which is used in ReportCustomFlags(). Returns the UMA id for the specified switch name. https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:175: // This is used on ChromeOS to report flags that lead to browser restart. If this is only for chromeos, can we move it into the chromeos directory?
https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1522: UMA_HISTOGRAM_ID_kEnableAccessibilityTabSwitcher) On 2014/08/05 16:49:14, sky wrote: > Why are you doing this change? It is a bug. Thank you for pointing out. Fixed. https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:25: // This value is reported as swtich histogram ID if switch name has unknown On 2014/08/05 16:49:14, sky wrote: > swtich->switch Done. https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:171: // Returns commans-line switch UMA ID, which is used in ReportCustomFlags(). On 2014/08/05 16:49:14, sky wrote: > Returns the UMA id for the specified switch name. Done. https://codereview.chromium.org/344883002/diff/360001/chrome/browser/about_fl... chrome/browser/about_flags.h:175: // This is used on ChromeOS to report flags that lead to browser restart. On 2014/08/05 16:49:14, sky wrote: > If this is only for chromeos, can we move it into the chromeos directory? It was there in the first versions of this CL, but as the functionality is not limited to ChromeOS, thestig@ advised to move it to about_flags.cc . Probably it will be used on other OSes once. The comment doesn't say it is limited to ChromeOS (I hope), but it just points to the only usage for now. There is another reason for this code to be in about_flags : because about_flags internals depend on the ability to report a set of switches to UMA. So it basically explains the way it is done.
https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (left): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1528: }, This diff seems unrelated to your CL. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2275: return static_cast<unsigned>( Please cast directly to the returned type, i.e. uint32. Also, please use a checked_cast. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2276: crc32(0, Optional: md5 is more commonly used for UMA code. It's fine to use any hash function you like here, but you might want to at least double-check whether Dremel natively supports crc32 before using it. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2288: if (it->size() > 2) { It seems more appropriate to check the actual characters of the prefix, rather than just its length. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2488: const Experiment& e = experiments[i]; nit: Please use complete variable names rather than abbreviations. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2502: } Why isn't this in the testing namespace below? In fact, it looks like you could just use GetExperiments() from below, and then implement this function in the test file. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.h:172: uint32 GetSwitchUMAId(const std::string& switch_name); Please be consistent about the integer types you use. Above you use uint32_t; here you use uint32. I believe that uint32_t is preferred. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:42: typedef std::map<std::string, uint32> Switch2IdMap; Please spell out "To", rather than using "2". https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:649: class AboutFlagsHistogramTest : public ::testing::Test { I'm not an owner for this file, but I think it's generally considered to be best practice to have only a single test class per unittest.cc file. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:653: std::map<std::string, uint32>* out_map) { nit: Docs. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:664: uint32 value) { nit: Docs. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39286: +To add new entry, add if with any value and run test to compute valid value. I think it would be better to have a separate target -- implemented either in C++ or in Python -- that just updates this file. But a test is fine for now, if you're really keen on it. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39286: +To add new entry, add if with any value and run test to compute valid value. nit: "new entry" -> "a new entry"; "if" -> "it" https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39287: +--> Please put this comment below the "<enum>" opening tag. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results IMO this presubmit script is not needed now that you're using hashes, since there aren't any collisions expected. The reason that the other approach needed a presubmit check was that one person accidentally inserting an entry in the wrong spot in the enum would ruin the entire data collection process. That's not a concern with hashes.
https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results On 2014/08/05 20:14:47, Ilya Sherman wrote: > IMO this presubmit script is not needed now that you're using hashes, since > there aren't any collisions expected. The reason that the other approach needed > a presubmit check was that one person accidentally inserting an entry in the > wrong spot in the enum would ruin the entire data collection process. That's > not a concern with hashes. Don't we want to have a presubmit that ensures that histograms.xml is updated as new flags are added to the C++ code?
https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results On 2014/08/05 20:47:52, Alexei Svitkine wrote: > On 2014/08/05 20:14:47, Ilya Sherman wrote: > > IMO this presubmit script is not needed now that you're using hashes, since > > there aren't any collisions expected. The reason that the other approach > needed > > a presubmit check was that one person accidentally inserting an entry in the > > wrong spot in the enum would ruin the entire data collection process. That's > > not a concern with hashes. > > Don't we want to have a presubmit that ensures that histograms.xml is updated as > new flags are added to the C++ code? Alex added a unit test that does this. According to the comment at the top of the file, the presubmit script just verifies that nothing is removed from the enum.
https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (left): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1528: }, On 2014/08/05 20:14:46, Ilya Sherman wrote: > This diff seems unrelated to your CL. As this CL doesn't have explicit UMA IDs, this part looks irrelevant. But at the beginning we agreed that I would drop this (unused) part, and it saves extra ID from UMA. Do you think we should reserve ID for this switch? https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2275: return static_cast<unsigned>( On 2014/08/05 20:14:46, Ilya Sherman wrote: > Please cast directly to the returned type, i.e. uint32. Also, please use a > checked_cast. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2276: crc32(0, On 2014/08/05 20:14:46, Ilya Sherman wrote: > Optional: md5 is more commonly used for UMA code. It's fine to use any hash > function you like here, but you might want to at least double-check whether > Dremel natively supports crc32 before using it. On a server-side it looks like uint32, so it doesn't need special suport, does it? Also, MD5 doesn't fit 32bit integer, so what ID type should I use here? https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2288: if (it->size() > 2) { On 2014/08/05 20:14:46, Ilya Sherman wrote: > It seems more appropriate to check the actual characters of the prefix, rather > than just its length. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2488: const Experiment& e = experiments[i]; On 2014/08/05 20:14:46, Ilya Sherman wrote: > nit: Please use complete variable names rather than abbreviations. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2502: } On 2014/08/05 20:14:46, Ilya Sherman wrote: > Why isn't this in the testing namespace below? In fact, it looks like you could > just use GetExperiments() from below, and then implement this function in the > test file. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.h (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.h:172: uint32 GetSwitchUMAId(const std::string& switch_name); On 2014/08/05 20:14:46, Ilya Sherman wrote: > Please be consistent about the integer types you use. Above you use uint32_t; > here you use uint32. I believe that uint32_t is preferred. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags_unittest.cc (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:42: typedef std::map<std::string, uint32> Switch2IdMap; On 2014/08/05 20:14:46, Ilya Sherman wrote: > Please spell out "To", rather than using "2". Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:649: class AboutFlagsHistogramTest : public ::testing::Test { On 2014/08/05 20:14:46, Ilya Sherman wrote: > I'm not an owner for this file, but I think it's generally > considered to be best > practice to have only a single test class per unittest.cc file. Done. There is no explicit OWNER for this file. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:653: std::map<std::string, uint32>* out_map) { On 2014/08/05 20:14:46, Ilya Sherman wrote: > nit: Docs. Done. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags_unittest.cc:664: uint32 value) { On 2014/08/05 20:14:46, Ilya Sherman wrote: > nit: Docs. Done. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39286: +To add new entry, add if with any value and run test to compute valid value. On 2014/08/05 20:14:46, Ilya Sherman wrote: > nit: "new entry" -> "a new entry"; "if" -> "it" Done. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/histograms.xml:39287: +--> On 2014/08/05 20:14:47, Ilya Sherman wrote: > Please put this comment below the "<enum>" opening tag. Done. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results On 2014/08/05 20:14:47, Ilya Sherman wrote: > IMO this presubmit script is not needed now that you're using hashes, since > there aren't any collisions expected. The reason that the other approach needed > a presubmit check was that one person accidentally inserting an entry in the > wrong spot in the enum would ruin the entire data collection process. That's > not a concern with hashes. Unit test cannot check that values are not removed. So I would better add this check.
https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (left): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1528: }, On 2014/08/07 23:24:55, alemate wrote: > On 2014/08/05 20:14:46, Ilya Sherman wrote: > > This diff seems unrelated to your CL. > > As this CL doesn't have explicit UMA IDs, this part looks irrelevant. > But at the beginning we agreed that I would drop this (unused) part, > and it saves extra ID from UMA. > > Do you think we should reserve ID for this switch? If this switch is obsolete, I'd prefer that you remove it in a separate, tiny CL, since it's easy for the change to get lost in a large CL like this one. https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2276: crc32(0, On 2014/08/07 23:24:56, alemate wrote: > On 2014/08/05 20:14:46, Ilya Sherman wrote: > > Optional: md5 is more commonly used for UMA code. It's fine to use any hash > > function you like here, but you might want to at least double-check whether > > Dremel natively supports crc32 before using it. > > On a server-side it looks like uint32, so it doesn't need special suport, does > it? The only reason that special support might be useful is that it's convenient for users to be able to type something like CRC("--enable-my-feature") in Dremel, without having to compute the CRC themselves. > Also, MD5 doesn't fit 32bit integer, so what ID type should I use here? For other UMA code, we just trim the MD5 hash as needed. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results On 2014/08/07 23:24:56, alemate wrote: > On 2014/08/05 20:14:47, Ilya Sherman wrote: > > IMO this presubmit script is not needed now that you're using hashes, since > > there aren't any collisions expected. The reason that the other approach > needed > > a presubmit check was that one person accidentally inserting an entry in the > > wrong spot in the enum would ruin the entire data collection process. That's > > not a concern with hashes. > > Unit test cannot check that values are not removed. > So I would better add this check. (a) None of the reviewers of this file would be likely to LGTM a CL that removed a switch. (b) Nobody editing this file is likely to accidentally remove a switch (c) Even if a switch were accidentally removed, it would be easy to restore, e.g. using code history. (d) No data is corrupted if the histograms.xml file is not up-to-date -- it's purely metadata. For all of these reasons, I don't think it's worthwhile to have over 200 lines of code (plus tests) just to verify that values are not removed. I strongly encourage you to either keep the C++ unittest or to write a complete presubmit check; but not both. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags.cc:7: #include <stdint.h> nit: This is already included in the header file. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2277: return base::checked_cast<unsigned>( nit: unsigned -> uint32_t https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:11: #include "base/prefs/testing_pref_service.h"*/ Please update this. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:20: //#include "grit/chromium_strings.h" Please update this.
https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (left): https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... chrome/browser/about_flags.cc:1528: }, On 2014/08/08 03:49:45, Ilya Sherman wrote: > On 2014/08/07 23:24:55, alemate wrote: > > On 2014/08/05 20:14:46, Ilya Sherman wrote: > > > This diff seems unrelated to your CL. > > > > As this CL doesn't have explicit UMA IDs, this part looks irrelevant. > > But at the beginning we agreed that I would drop this (unused) part, > > and it saves extra ID from UMA. > > > > Do you think we should reserve ID for this switch? > > If this switch is obsolete, I'd prefer that you remove it in a separate, tiny > CL, since it's easy for the change to get lost in a large CL like this one. Done. https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... File tools/metrics/histograms/verify_enum_custom_flags.py (right): https://codereview.chromium.org/344883002/diff/380001/tools/metrics/histogram... tools/metrics/histograms/verify_enum_custom_flags.py:236: return self.results On 2014/08/08 03:49:45, Ilya Sherman wrote: > On 2014/08/07 23:24:56, alemate wrote: > > On 2014/08/05 20:14:47, Ilya Sherman wrote: > > > IMO this presubmit script is not needed now that you're using hashes, since > > > there aren't any collisions expected. The reason that the other approach > > needed > > > a presubmit check was that one person accidentally inserting an entry in the > > > wrong spot in the enum would ruin the entire data collection process. > That's > > > not a concern with hashes. > > > > Unit test cannot check that values are not removed. > > So I would better add this check. > > (a) None of the reviewers of this file would be likely to LGTM a CL that removed > a switch. > (b) Nobody editing this file is likely to accidentally remove a switch > (c) Even if a switch were accidentally removed, it would be easy to restore, > e.g. using code history. > (d) No data is corrupted if the histograms.xml file is not up-to-date -- it's > purely metadata. > > For all of these reasons, I don't think it's worthwhile to have over 200 lines > of code (plus tests) just to verify that values are not removed. I strongly > encourage you to either keep the C++ unittest or to write a complete presubmit > check; but not both. Done. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags.cc:7: #include <stdint.h> On 2014/08/08 03:49:45, Ilya Sherman wrote: > nit: This is already included in the header file. Done. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2277: return base::checked_cast<unsigned>( On 2014/08/08 03:49:45, Ilya Sherman wrote: > nit: unsigned -> uint32_t Done. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:11: #include "base/prefs/testing_pref_service.h"*/ On 2014/08/08 03:49:45, Ilya Sherman wrote: > Please update this. Done. https://codereview.chromium.org/344883002/diff/400001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:20: //#include "grit/chromium_strings.h" On 2014/08/08 03:49:45, Ilya Sherman wrote: > Please update this. Done.
LGTM. Thanks.
sky@: Do you have additional comments?
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): histogram='" << uma_histogram_hame << "' '" Is there a reason you want VLOG here and not DVLOG? https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2014. But is there a reason this is a separate file and not part of the the existing unittest? https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:22: // This is a helper function to the next one. 'the next one' makes no sense here. https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") I believe this is going to require updating isolate files for swarming. Also, does adding this as a dependency for the test work? If not, you'll need to update the exclusions list for the analyze step. See https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... for details.
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): histogram='" << uma_histogram_hame << "' '" On 2014/08/11 23:45:44, sky wrote: > Is there a reason you want VLOG here and not DVLOG? The idea is see the "reason to restart" in verbose log. https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) 2011 The Chromium Authors. All rights reserved. On 2014/08/11 23:45:45, sky wrote: > 2014. But is there a reason this is a separate file and not part > of the the existing unittest? This was Ilya's idea: https://codereview.chromium.org/344883002/diff/380001/chrome/browser/about_fl... https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:22: // This is a helper function to the next one. On 2014/08/11 23:45:45, sky wrote: > 'the next one' makes no sense here. Done. https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") On 2014/08/11 23:45:45, sky wrote: > I believe this is going to require updating isolate files for > swarming. This CL includes a change to chrome/unit_tests.isolate . Is it enough? > Also, does adding this as a dependency for the test work? > If not, you'll need to > update the exclusions list for the analyze step. See > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > for details. How can I add dependency for AboutFlagsHistogramTest test? As far as I understand your URL, it says : "If you have added test dependency and it doesn't work, add your file to exclusions" . But how do I add the dependency? And how do I check it works?
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): histogram='" << uma_histogram_hame << "' '" On 2014/08/12 18:02:25, alemate wrote: > On 2014/08/11 23:45:44, sky wrote: > > Is there a reason you want VLOG here and not DVLOG? > > The idea is see the "reason to restart" in verbose log. "The idea is to see" ...
Whoops, wrote a comment yesterday but failed to mail it: https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) 2011 The Chromium Authors. All rights reserved. On 2014/08/11 23:45:45, sky wrote: > 2014. But is there a reason this is a separate file and not part of the the > existing unittest? FWIW, I recommended moving this out to a separate file, as the test uses a separate test fixture. If you'd prefer that it be moved back, I'm ok with being overruled :)
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): histogram='" << uma_histogram_hame << "' '" On 2014/08/12 18:03:15, alemate wrote: > On 2014/08/12 18:02:25, alemate wrote: > > On 2014/08/11 23:45:44, sky wrote: > > > Is there a reason you want VLOG here and not DVLOG? > > > > The idea is see the "reason to restart" in verbose log. > > "The idea is to see" ... Certainly, but why release and not debug? Do you really need this for release builds? https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) 2011 The Chromium Authors. All rights reserved. On 2014/08/12 18:05:30, Ilya Sherman wrote: > On 2014/08/11 23:45:45, sky wrote: > > 2014. But is there a reason this is a separate file and not part of the the > > existing unittest? > > FWIW, I recommended moving this out to a separate file, as the test uses a > separate test fixture. If you'd prefer that it be moved back, I'm ok with being > overruled :) AFAIK the common pattern is to put them in the same file. Plenty of files use different fixtures. https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") On 2014/08/12 18:02:26, alemate wrote: > On 2014/08/11 23:45:45, sky wrote: > > I believe this is going to require updating isolate files for > > swarming. > > This CL includes a change to chrome/unit_tests.isolate . Is it enough? > > > Also, does adding this as a dependency for the test work? > > If not, you'll need to > > update the exclusions list for the analyze step. See > > > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > > for details. > > How can I add dependency for AboutFlagsHistogramTest test? > As far as I understand your URL, it says : "If you have added test > dependency and it doesn't work, add your file to exclusions" . But > how do I add the dependency? And how do I check it works? If you can express the dependency in the gyp/gypi file and that works as a dependency, then the analyze step will recognize that if you change histograms.xml then unit tests must work. I don't know if listing the dependency as a source will work, but you could try. If it isn't possible, meaning you can't express the dependency, then add the file to the list of exclusions. You could check the dependency route by creating a separate patch that adds the dependency to the appropriate gyp/gypi file, modifies histograms.xml, and modify the exclusion file by removing the line with ".*gyp[i]?". Now do a try job and verify unit_tests gets run.
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") On 2014/08/12 19:57:13, sky wrote: > On 2014/08/12 18:02:26, alemate wrote: > > On 2014/08/11 23:45:45, sky wrote: > > > I believe this is going to require updating isolate files for > > > swarming. > > > > This CL includes a change to chrome/unit_tests.isolate . Is it enough? > > > > > Also, does adding this as a dependency for the test work? > > > If not, you'll need to > > > update the exclusions list for the analyze step. See > > > > > > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > > > for details. > > > > How can I add dependency for AboutFlagsHistogramTest test? > > As far as I understand your URL, it says : "If you have added test > > dependency and it doesn't work, add your file to exclusions" . But > > how do I add the dependency? And how do I check it works? > > If you can express the dependency in the gyp/gypi file and that works as a > dependency, then the analyze step will recognize that if you change > histograms.xml then unit tests must work. I don't know if listing the dependency > as a source will work, but you could try. If it isn't possible, meaning you > can't express the dependency, then add the file to the list of exclusions. > > You could check the dependency route by creating a separate patch that adds the > dependency to the appropriate gyp/gypi file, modifies histograms.xml, and modify > the exclusion file by removing the line with ".*gyp[i]?". Now do a try job and > verify unit_tests gets run. Oof, I'd really prefer not to have *all* changes to histograms.xml trigger unit_tests runs. Is it possible to have a tighter coupling, so that changes to histograms.xml only trigger this one test to run? If not, we can use the sledgehammer approach for now... but if we do, it would be really nice to fix this in the future. I routinely submit histograms.xml changes with NOTRY=true, because it's a huge waste of trybot cycles otherwise. I'd love to see the tooling catch up so that I don't need to do this.
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") On 2014/08/12 20:07:16, Ilya Sherman wrote: > On 2014/08/12 19:57:13, sky wrote: > > On 2014/08/12 18:02:26, alemate wrote: > > > On 2014/08/11 23:45:45, sky wrote: > > > > I believe this is going to require updating isolate files for > > > > swarming. > > > > > > This CL includes a change to chrome/unit_tests.isolate . Is it enough? > > > > > > > Also, does adding this as a dependency for the test work? > > > > If not, you'll need to > > > > update the exclusions list for the analyze step. See > > > > > > > > > > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > > > > for details. > > > > > > How can I add dependency for AboutFlagsHistogramTest test? > > > As far as I understand your URL, it says : "If you have added test > > > dependency and it doesn't work, add your file to exclusions" . But > > > how do I add the dependency? And how do I check it works? > > > > If you can express the dependency in the gyp/gypi file and that works as a > > dependency, then the analyze step will recognize that if you change > > histograms.xml then unit tests must work. I don't know if listing the > dependency > > as a source will work, but you could try. If it isn't possible, meaning you > > can't express the dependency, then add the file to the list of exclusions. > > > > You could check the dependency route by creating a separate patch that adds > the > > dependency to the appropriate gyp/gypi file, modifies histograms.xml, and > modify > > the exclusion file by removing the line with ".*gyp[i]?". Now do a try job and > > verify unit_tests gets run. > > Oof, I'd really prefer not to have *all* changes to histograms.xml trigger > unit_tests runs. Is it possible to have a tighter coupling, so that changes to > histograms.xml only trigger this one test to run? If not, we can use the > sledgehammer approach for now... but if we do, it would be really nice to fix > this in the future. I routinely submit histograms.xml changes with NOTRY=true, > because it's a huge waste of trybot cycles otherwise. I'd love to see the > tooling catch up so that I don't need to do this. We currently only have the sledgehammer:(
https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): histogram='" << uma_histogram_hame << "' '" On 2014/08/12 19:57:13, sky wrote: > On 2014/08/12 18:03:15, alemate wrote: > > On 2014/08/12 18:02:25, alemate wrote: > > > On 2014/08/11 23:45:44, sky wrote: > > > > Is there a reason you want VLOG here and not DVLOG? > > > > > > The idea is see the "reason to restart" in verbose log. > > > > "The idea is to see" ... > > Certainly, but why release and not debug? Do you really need this for release > builds? Running debug build on device is very slow. So it is usually "last resort" option. I moved VLOG() to chromeos-specific code, and replaced if here with DVLOG(). https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... File chrome/browser/about_flags_histogram_unittest.cc (right): https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) 2011 The Chromium Authors. All rights reserved. On 2014/08/12 19:57:13, sky wrote: > On 2014/08/12 18:05:30, Ilya Sherman wrote: > > On 2014/08/11 23:45:45, sky wrote: > > > 2014. But is there a reason this is a separate file and not part of the the > > > existing unittest? > > > > FWIW, I recommended moving this out to a separate file, as the test uses a > > separate test fixture. If you'd prefer that it be moved back, I'm ok with > being > > overruled :) > > AFAIK the common pattern is to put them in the same file. Plenty of files use > different fixtures. Done. https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... chrome/browser/about_flags_histogram_unittest.cc:216: histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") On 2014/08/12 19:57:13, sky wrote: > On 2014/08/12 18:02:26, alemate wrote: > > On 2014/08/11 23:45:45, sky wrote: > > > I believe this is going to require updating isolate files for > > > swarming. > > > > This CL includes a change to chrome/unit_tests.isolate . Is it enough? > > > > > Also, does adding this as a dependency for the test work? > > > If not, you'll need to > > > update the exclusions list for the analyze step. See > > > > > > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > > > for details. > > > > How can I add dependency for AboutFlagsHistogramTest test? > > As far as I understand your URL, it says : "If you have added test > > dependency and it doesn't work, add your file to exclusions" . But > > how do I add the dependency? And how do I check it works? > > If you can express the dependency in the gyp/gypi file and that works as a > dependency, then the analyze step will recognize that if you change > histograms.xml then unit tests must work. I don't know if listing the dependency > as a source will work, but you could try. If it isn't possible, meaning you > can't express the dependency, then add the file to the list of exclusions. > > You could check the dependency route by creating a separate patch that adds the > dependency to the appropriate gyp/gypi file, modifies histograms.xml, and modify > the exclusion file by removing the line with ".*gyp[i]?". Now do a try job and > verify unit_tests gets run. It seems that adding histograms.xml to the list of sources works: https://codereview.chromium.org/470613002/#ps20001 (there is another CL3 with additional changes to exclusions, but it seems it is enough to add to sources).
On Wed, Aug 13, 2014 at 12:59 PM, <alemate@chromium.org> wrote: > > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > File chrome/browser/about_flags.cc (right): > > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): > histogram='" << uma_histogram_hame << "' '" > On 2014/08/12 19:57:13, sky wrote: >> >> On 2014/08/12 18:03:15, alemate wrote: >> > On 2014/08/12 18:02:25, alemate wrote: >> > > On 2014/08/11 23:45:44, sky wrote: >> > > > Is there a reason you want VLOG here and not DVLOG? >> > > >> > > The idea is see the "reason to restart" in verbose log. >> > >> > "The idea is to see" ... > > >> Certainly, but why release and not debug? Do you really need this for > > release >> >> builds? > > > Running debug build on device is very slow. So it is usually > "last resort" option. > > I moved VLOG() to chromeos-specific code, and replaced if here with > DVLOG(). > > > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > File chrome/browser/about_flags_histogram_unittest.cc (right): > > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) > 2011 The Chromium Authors. All rights reserved. > On 2014/08/12 19:57:13, sky wrote: >> >> On 2014/08/12 18:05:30, Ilya Sherman wrote: >> > On 2014/08/11 23:45:45, sky wrote: >> > > 2014. But is there a reason this is a separate file and not part > > of the the >> >> > > existing unittest? >> > >> > FWIW, I recommended moving this out to a separate file, as the test > > uses a >> >> > separate test fixture. If you'd prefer that it be moved back, I'm > > ok with >> >> being >> > overruled :) > > >> AFAIK the common pattern is to put them in the same file. Plenty of > > files use >> >> different fixtures. > > > Done. > > > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > chrome/browser/about_flags_histogram_unittest.cc:216: > histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") > On 2014/08/12 19:57:13, sky wrote: >> >> On 2014/08/12 18:02:26, alemate wrote: >> > On 2014/08/11 23:45:45, sky wrote: >> > > I believe this is going to require updating isolate files for >> > > swarming. >> > >> > This CL includes a change to chrome/unit_tests.isolate . Is it > > enough? >> >> > >> > > Also, does adding this as a dependency for the test work? >> > > If not, you'll need to >> > > update the exclusions list for the analyze step. See >> > > >> > > > > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... >> >> > > for details. >> > >> > How can I add dependency for AboutFlagsHistogramTest test? >> > As far as I understand your URL, it says : "If you have added test >> > dependency and it doesn't work, add your file to exclusions" . But >> > how do I add the dependency? And how do I check it works? > > >> If you can express the dependency in the gyp/gypi file and that works > > as a >> >> dependency, then the analyze step will recognize that if you change >> histograms.xml then unit tests must work. I don't know if listing the > > dependency >> >> as a source will work, but you could try. If it isn't possible, > > meaning you >> >> can't express the dependency, then add the file to the list of > > exclusions. > >> You could check the dependency route by creating a separate patch that > > adds the >> >> dependency to the appropriate gyp/gypi file, modifies histograms.xml, > > and modify >> >> the exclusion file by removing the line with ".*gyp[i]?". Now do a try > > job and >> >> verify unit_tests gets run. > > > It seems that adding histograms.xml to the list of sources works: > https://codereview.chromium.org/470613002/#ps20001 > (there is another CL3 with additional changes to exclusions, but it > seems it is enough to add to sources). That test wasn't conclusive. You need to remove 'testing/buildbot/.*' too. Sorry for not realizing that. Also, could you add a comment as to why histograms.xml as listed as a source. It's not readily obvious why. -Scott > > https://codereview.chromium.org/344883002/ To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On Wed, Aug 13, 2014 at 1:13 PM, Scott Violet <sky@chromium.org> wrote: > On Wed, Aug 13, 2014 at 12:59 PM, <alemate@chromium.org> wrote: >> >> https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... >> File chrome/browser/about_flags.cc (right): >> >> https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... >> chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): >> histogram='" << uma_histogram_hame << "' '" >> On 2014/08/12 19:57:13, sky wrote: >>> >>> On 2014/08/12 18:03:15, alemate wrote: >>> > On 2014/08/12 18:02:25, alemate wrote: >>> > > On 2014/08/11 23:45:44, sky wrote: >>> > > > Is there a reason you want VLOG here and not DVLOG? >>> > > >>> > > The idea is see the "reason to restart" in verbose log. >>> > >>> > "The idea is to see" ... >> >> >>> Certainly, but why release and not debug? Do you really need this for >> >> release >>> >>> builds? >> >> >> Running debug build on device is very slow. So it is usually >> "last resort" option. >> >> I moved VLOG() to chromeos-specific code, and replaced if here with >> DVLOG(). >> >> >> https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... >> File chrome/browser/about_flags_histogram_unittest.cc (right): >> >> https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... >> chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) >> 2011 The Chromium Authors. All rights reserved. >> On 2014/08/12 19:57:13, sky wrote: >>> >>> On 2014/08/12 18:05:30, Ilya Sherman wrote: >>> > On 2014/08/11 23:45:45, sky wrote: >>> > > 2014. But is there a reason this is a separate file and not part >> >> of the the >>> >>> > > existing unittest? >>> > >>> > FWIW, I recommended moving this out to a separate file, as the test >> >> uses a >>> >>> > separate test fixture. If you'd prefer that it be moved back, I'm >> >> ok with >>> >>> being >>> > overruled :) >> >> >>> AFAIK the common pattern is to put them in the same file. Plenty of >> >> files use >>> >>> different fixtures. >> >> >> Done. >> >> >> https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... >> chrome/browser/about_flags_histogram_unittest.cc:216: >> histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") >> On 2014/08/12 19:57:13, sky wrote: >>> >>> On 2014/08/12 18:02:26, alemate wrote: >>> > On 2014/08/11 23:45:45, sky wrote: >>> > > I believe this is going to require updating isolate files for >>> > > swarming. >>> > >>> > This CL includes a change to chrome/unit_tests.isolate . Is it >> >> enough? >>> >>> > >>> > > Also, does adding this as a dependency for the test work? >>> > > If not, you'll need to >>> > > update the exclusions list for the analyze step. See >>> > > >>> > >> >> >> https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... >>> >>> > > for details. >>> > >>> > How can I add dependency for AboutFlagsHistogramTest test? >>> > As far as I understand your URL, it says : "If you have added test >>> > dependency and it doesn't work, add your file to exclusions" . But >>> > how do I add the dependency? And how do I check it works? >> >> >>> If you can express the dependency in the gyp/gypi file and that works >> >> as a >>> >>> dependency, then the analyze step will recognize that if you change >>> histograms.xml then unit tests must work. I don't know if listing the >> >> dependency >>> >>> as a source will work, but you could try. If it isn't possible, >> >> meaning you >>> >>> can't express the dependency, then add the file to the list of >> >> exclusions. >> >>> You could check the dependency route by creating a separate patch that >> >> adds the >>> >>> dependency to the appropriate gyp/gypi file, modifies histograms.xml, >> >> and modify >>> >>> the exclusion file by removing the line with ".*gyp[i]?". Now do a try >> >> job and >>> >>> verify unit_tests gets run. >> >> >> It seems that adding histograms.xml to the list of sources works: >> https://codereview.chromium.org/470613002/#ps20001 >> (there is another CL3 with additional changes to exclusions, but it >> seems it is enough to add to sources). > > That test wasn't conclusive. You need to remove 'testing/buildbot/.*' > too. Sorry for not realizing that. Also, you can tell this happened because the analyze step produced this output: http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel/... testing/buildbot/trybot_analyze_config.json (regex = 'testing/buildbot/.*') which means one of the files matched an exclusion rule and so everything is going to be built and run. -Scott > > Also, could you add a comment as to why histograms.xml as listed as a > source. It's not readily obvious why. > > -Scott > >> >> https://codereview.chromium.org/344883002/ To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/08/13 20:14:28, sky wrote: > On Wed, Aug 13, 2014 at 1:13 PM, Scott Violet <mailto:sky@chromium.org> wrote: > > On Wed, Aug 13, 2014 at 12:59 PM, <mailto:alemate@chromium.org> wrote: > >> > >> > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > >> File chrome/browser/about_flags.cc (right): > >> > >> > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > >> chrome/browser/about_flags.cc:2309: VLOG(1) << "ReportCustomFlags(): > >> histogram='" << uma_histogram_hame << "' '" > >> On 2014/08/12 19:57:13, sky wrote: > >>> > >>> On 2014/08/12 18:03:15, alemate wrote: > >>> > On 2014/08/12 18:02:25, alemate wrote: > >>> > > On 2014/08/11 23:45:44, sky wrote: > >>> > > > Is there a reason you want VLOG here and not DVLOG? > >>> > > > >>> > > The idea is see the "reason to restart" in verbose log. > >>> > > >>> > "The idea is to see" ... > >> > >> > >>> Certainly, but why release and not debug? Do you really need this for > >> > >> release > >>> > >>> builds? > >> > >> > >> Running debug build on device is very slow. So it is usually > >> "last resort" option. > >> > >> I moved VLOG() to chromeos-specific code, and replaced if here with > >> DVLOG(). > >> > >> > >> > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > >> File chrome/browser/about_flags_histogram_unittest.cc (right): > >> > >> > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > >> chrome/browser/about_flags_histogram_unittest.cc:1: // Copyright (c) > >> 2011 The Chromium Authors. All rights reserved. > >> On 2014/08/12 19:57:13, sky wrote: > >>> > >>> On 2014/08/12 18:05:30, Ilya Sherman wrote: > >>> > On 2014/08/11 23:45:45, sky wrote: > >>> > > 2014. But is there a reason this is a separate file and not part > >> > >> of the the > >>> > >>> > > existing unittest? > >>> > > >>> > FWIW, I recommended moving this out to a separate file, as the test > >> > >> uses a > >>> > >>> > separate test fixture. If you'd prefer that it be moved back, I'm > >> > >> ok with > >>> > >>> being > >>> > overruled :) > >> > >> > >>> AFAIK the common pattern is to put them in the same file. Plenty of > >> > >> files use > >>> > >>> different fixtures. > >> > >> > >> Done. > >> > >> > >> > https://codereview.chromium.org/344883002/diff/420001/chrome/browser/about_fl... > >> chrome/browser/about_flags_histogram_unittest.cc:216: > >> histograms_xml_file_path = histograms_xml_file_path.AppendASCII("tools") > >> On 2014/08/12 19:57:13, sky wrote: > >>> > >>> On 2014/08/12 18:02:26, alemate wrote: > >>> > On 2014/08/11 23:45:45, sky wrote: > >>> > > I believe this is going to require updating isolate files for > >>> > > swarming. > >>> > > >>> > This CL includes a change to chrome/unit_tests.isolate . Is it > >> > >> enough? > >>> > >>> > > >>> > > Also, does adding this as a dependency for the test work? > >>> > > If not, you'll need to > >>> > > update the exclusions list for the analyze step. See > >>> > > > >>> > > >> > >> > >> > https://sites.google.com/a/chromium.org/dev/developers/testing/commit-queue/c... > >>> > >>> > > for details. > >>> > > >>> > How can I add dependency for AboutFlagsHistogramTest test? > >>> > As far as I understand your URL, it says : "If you have added test > >>> > dependency and it doesn't work, add your file to exclusions" . But > >>> > how do I add the dependency? And how do I check it works? > >> > >> > >>> If you can express the dependency in the gyp/gypi file and that works > >> > >> as a > >>> > >>> dependency, then the analyze step will recognize that if you change > >>> histograms.xml then unit tests must work. I don't know if listing the > >> > >> dependency > >>> > >>> as a source will work, but you could try. If it isn't possible, > >> > >> meaning you > >>> > >>> can't express the dependency, then add the file to the list of > >> > >> exclusions. > >> > >>> You could check the dependency route by creating a separate patch that > >> > >> adds the > >>> > >>> dependency to the appropriate gyp/gypi file, modifies histograms.xml, > >> > >> and modify > >>> > >>> the exclusion file by removing the line with ".*gyp[i]?". Now do a try > >> > >> job and > >>> > >>> verify unit_tests gets run. > >> > >> > >> It seems that adding histograms.xml to the list of sources works: > >> https://codereview.chromium.org/470613002/#ps20001 > >> (there is another CL3 with additional changes to exclusions, but it > >> seems it is enough to add to sources). > > > > That test wasn't conclusive. You need to remove 'testing/buildbot/.*' > > too. Sorry for not realizing that. > > Also, you can tell this happened because the analyze step produced this output: > > http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel/... > > testing/buildbot/trybot_analyze_config.json (regex = 'testing/buildbot/.*') > > which means one of the files matched an exclusion rule and so > everything is going to be built and run. Yes, you are right. histograms.xml has to be added to exceptions. Also I've added a comment in chrome/chrome_tests_unit.gypi on histograms.xml listed in sources. PTAL.
Bummer, but ok, LGTM
The CQ bit was checked by alemate@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alemate@chromium.org/344883002/560001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_aosp on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/bu...) win_chromium_rel_swarming on tryserver.chromium.win (http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_aosp on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/bu...)
The CQ bit was checked by nkostylev@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alemate@chromium.org/344883002/560001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_aosp on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/bu...)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_aosp on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/bu...)
Rebase is needed: Applying the patch. Failed to apply patch for chrome/browser/about_flags.cc:
The CQ bit was checked by alemate@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alemate@chromium.org/344883002/560001
The CQ bit was unchecked by alemate@chromium.org
The CQ bit was checked by alemate@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alemate@chromium.org/344883002/580001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_chromium_chromeos_rel_swarming on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Message was sent while issue was closed.
Committed patchset #30 (580001) as 289919
I noticed that we see a bunch of hashes which the dashboard isn't able to map to flags with this histogram: https://uma.googleplex.com/p/chrome/histograms/?dayCount=1&endDate=08-21-2014... Any idea where those are coming from? Could it be that we're missing some flags (e.g. those defined in components or elsewhere)? Could you investigate making the mapping more comprehensive? Thanks. On Fri, Aug 15, 2014 at 1:13 PM, <commit-bot@chromium.org> wrote: > Committed patchset #30 (580001) as 289919 > > https://codereview.chromium.org/344883002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Also, a lot of the unmapped ones above seem to have negative values, while the XML file doesn't have any with negative values. Perhaps there's an issue with signed/unsigned conversion? (I didn't check your CL, but my impression was that the plan was to always send positive hashes - i.e. strip the sign bit - perhaps the C++ code doesn't do that while the code that generates the XML definition does?) On Fri, Aug 22, 2014 at 11:04 AM, Alexei Svitkine <asvitkine@google.com> wrote: > I noticed that we see a bunch of hashes which the dashboard isn't able to > map to flags with this histogram: > > > https://uma.googleplex.com/p/chrome/histograms/?dayCount=1&endDate=08-21-2014... > > Any idea where those are coming from? > > Could it be that we're missing some flags (e.g. those defined in > components or elsewhere)? Could you investigate making the mapping more > comprehensive? Thanks. > > > On Fri, Aug 15, 2014 at 1:13 PM, <commit-bot@chromium.org> wrote: > >> Committed patchset #30 (580001) as 289919 >> >> https://codereview.chromium.org/344883002/ >> > > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
I'll look into it. (During the last 4 days git migration happened and I am currently trying to make my checkout process work.) On Fri, Aug 22, 2014 at 7:07 PM, Alexei Svitkine <asvitkine@google.com> wrote: > Also, a lot of the unmapped ones above seem to have negative values, while > the XML file doesn't have any with negative values. Perhaps there's an > issue with signed/unsigned conversion? (I didn't check your CL, but my > impression was that the plan was to always send positive hashes - i.e. > strip the sign bit - perhaps the C++ code doesn't do that while the code > that generates the XML definition does?) > > > On Fri, Aug 22, 2014 at 11:04 AM, Alexei Svitkine <asvitkine@google.com> > wrote: > >> I noticed that we see a bunch of hashes which the dashboard isn't able to >> map to flags with this histogram: >> >> >> https://uma.googleplex.com/p/chrome/histograms/?dayCount=1&endDate=08-21-2014... >> >> Any idea where those are coming from? >> >> Could it be that we're missing some flags (e.g. those defined in >> components or elsewhere)? Could you investigate making the mapping more >> comprehensive? Thanks. >> >> >> On Fri, Aug 15, 2014 at 1:13 PM, <commit-bot@chromium.org> wrote: >> >>> Committed patchset #30 (580001) as 289919 >>> >>> https://codereview.chromium.org/344883002/ >>> >> >> > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Actually CustomFlags histogram is reported as full uint32_t . On the other hand, most chromeOS devices are 32-bit, so locally those integers are negative. Negative integers in uma.googleplex.com means that histogram values are actually signed and have different repsesentation on 32 oand 64-bit systems. That's sad. I'll make the fix for it. On Fri, Aug 22, 2014 at 7:07 PM, Alexei Svitkine <asvitkine@google.com> wrote: > Also, a lot of the unmapped ones above seem to have negative values, while > the XML file doesn't have any with negative values. Perhaps there's an > issue with signed/unsigned conversion? (I didn't check your CL, but my > impression was that the plan was to always send positive hashes - i.e. > strip the sign bit - perhaps the C++ code doesn't do that while the code > that generates the XML definition does?) > > > On Fri, Aug 22, 2014 at 11:04 AM, Alexei Svitkine <asvitkine@google.com> > wrote: > >> I noticed that we see a bunch of hashes which the dashboard isn't able to >> map to flags with this histogram: >> >> >> https://uma.googleplex.com/p/chrome/histograms/?dayCount=1&endDate=08-21-2014... >> >> Any idea where those are coming from? >> >> Could it be that we're missing some flags (e.g. those defined in >> components or elsewhere)? Could you investigate making the mapping more >> comprehensive? Thanks. >> >> >> On Fri, Aug 15, 2014 at 1:13 PM, <commit-bot@chromium.org> wrote: >> >>> Committed patchset #30 (580001) as 289919 >>> >>> https://codereview.chromium.org/344883002/ >>> >> >> > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org. |