| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
| 9 | 9 |
| 10 #include "ProcStats.h" |
| 10 #include "SkCommonFlags.h" | 11 #include "SkCommonFlags.h" |
| 11 #include "SkData.h" | 12 #include "SkData.h" |
| 12 #include "SkJSONCPP.h" | 13 #include "SkJSONCPP.h" |
| 13 #include "SkOSFile.h" | 14 #include "SkOSFile.h" |
| 14 #include "SkStream.h" | 15 #include "SkStream.h" |
| 15 #include "SkTArray.h" | 16 #include "SkTArray.h" |
| 16 #include "SkThread.h" | 17 #include "SkThread.h" |
| 17 | 18 |
| 18 namespace DM { | 19 namespace DM { |
| 19 | 20 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 Json::Value result; | 68 Json::Value result; |
| 68 result["file_name"] = gFailures[i].fileName; | 69 result["file_name"] = gFailures[i].fileName; |
| 69 result["line_no"] = gFailures[i].lineNo; | 70 result["line_no"] = gFailures[i].lineNo; |
| 70 result["condition"] = gFailures[i].condition; | 71 result["condition"] = gFailures[i].condition; |
| 71 result["message"] = gFailures[i].message.c_str(); | 72 result["message"] = gFailures[i].message.c_str(); |
| 72 | 73 |
| 73 root["test_results"]["failures"].append(result); | 74 root["test_results"]["failures"].append(result); |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 78 int maxResidentSetSizeMB = sk_tools::getMaxResidentSetSizeMB(); |
| 79 if (maxResidentSetSizeMB != -1) { |
| 80 root["max_rss_MB"] = sk_tools::getMaxResidentSetSizeMB(); |
| 81 } |
| 82 |
| 77 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json"); | 83 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json"); |
| 78 sk_mkdir(FLAGS_writePath[0]); | 84 sk_mkdir(FLAGS_writePath[0]); |
| 79 SkFILEWStream stream(path.c_str()); | 85 SkFILEWStream stream(path.c_str()); |
| 80 stream.writeText(Json::StyledWriter().write(root).c_str()); | 86 stream.writeText(Json::StyledWriter().write(root).c_str()); |
| 81 stream.flush(); | 87 stream.flush(); |
| 82 } | 88 } |
| 83 | 89 |
| 84 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { | 90 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { |
| 85 SkAutoTUnref<SkData> json(SkData::NewFromFileName(path)); | 91 SkAutoTUnref<SkData> json(SkData::NewFromFileName(path)); |
| 86 if (!json) { | 92 if (!json) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 br.config = r["key"]["config"].asCString(); | 108 br.config = r["key"]["config"].asCString(); |
| 103 br.sourceType = r["key"]["source_type"].asCString(); | 109 br.sourceType = r["key"]["source_type"].asCString(); |
| 104 br.ext = r["options"]["ext"].asCString(); | 110 br.ext = r["options"]["ext"].asCString(); |
| 105 br.md5 = r["md5"].asCString(); | 111 br.md5 = r["md5"].asCString(); |
| 106 callback(br); | 112 callback(br); |
| 107 } | 113 } |
| 108 return true; | 114 return true; |
| 109 } | 115 } |
| 110 | 116 |
| 111 } // namespace DM | 117 } // namespace DM |
| OLD | NEW |