Revert "Use std::fstream instead of rtc::File to write perf results + rename flag."

This reverts commit f711428898cb2f03d4d09738ba751cf0d316c631.

Reason for revert: Breaks downstream projects.

Original change's description:
> Use std::fstream instead of rtc::File to write perf results + rename flag.
> 
> Use std::fstream instead of rtc::File to write perf results.
> On Android, when I use rtc::File, the results are not written for some reason.
> 
> Also rename the flag to '--chartjson_result_file'.
> 
> Bug: webrtc:8566
> Change-Id: I32215e2233e18690c41050dfd35ac77e01d11f35
> Reviewed-on: https://webrtc-review.googlesource.com/32001
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#21225}

TBR=phoglund@webrtc.org,ehmaldonado@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:8566
Change-Id: I55611592c3171152cee97e64bff35a0d62cea510
Reviewed-on: https://webrtc-review.googlesource.com/33080
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21283}
This commit is contained in:
Mirko Bonadei
2017-12-14 15:05:18 +00:00
committed by Commit Bot
parent 1610f94ee3
commit 7284e8a650

View File

@ -8,8 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <fstream> #include "rtc_base/file.h"
#include "rtc_base/flags.h" #include "rtc_base/flags.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "system_wrappers/include/metrics_default.h" #include "system_wrappers/include/metrics_default.h"
@ -36,7 +35,7 @@ DEFINE_string(force_fieldtrials, "",
" will assign the group Enable to field trial WebRTC-FooFeature."); " will assign the group Enable to field trial WebRTC-FooFeature.");
DEFINE_string( DEFINE_string(
chartjson_result_file, perf_results_json_path,
"", "",
"Path where the perf results should be stored it the JSON format described " "Path where the perf results should be stored it the JSON format described "
"by " "by "
@ -74,12 +73,13 @@ int main(int argc, char* argv[]) {
int exit_code = RUN_ALL_TESTS(); int exit_code = RUN_ALL_TESTS();
std::string chartjson_result_file = FLAG_chartjson_result_file; std::string perf_results_json_path = FLAG_perf_results_json_path;
if (chartjson_result_file != "") { if (perf_results_json_path != "") {
std::string json_results = webrtc::test::GetPerfResultsJSON(); std::string json_results = webrtc::test::GetPerfResultsJSON();
std::fstream json_file(chartjson_result_file, std::fstream::out); rtc::File json_file = rtc::File::Open(perf_results_json_path);
json_file << json_results; json_file.Write(reinterpret_cast<const uint8_t*>(json_results.c_str()),
json_file.close(); json_results.size());
json_file.Close();
} }
return exit_code; return exit_code;