diff options
| author | 2017-12-06 11:52:02 -0800 | |
|---|---|---|
| committer | 2017-12-06 14:24:50 -0800 | |
| commit | d1a6d1eb81b14966a30a68b67996916ee27afb6f (patch) | |
| tree | f5100ca72ea06d172b17fd11f8403549315740d8 /cmds/dumpstate/dumpstate.cpp | |
| parent | 68686bd15198f64db633a757718b918895a1ca71 (diff) | |
| parent | 60175af9c8938d2362ec8a8b06543ce8c41b2338 (diff) | |
DO NOT MERGE: Merge Oreo MR1 into master
Exempt-From-Owner-Approval: Changes already landed internally
Change-Id: I37c19d77fbf144fb30cc2a2877247a855684d4ad
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
| -rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 9a3030e960..e792942670 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -126,8 +126,7 @@ static const std::string ZIP_ROOT_DIR = "FS"; static const std::string kDumpstateBoardPath = "/bugreports/"; static const std::string kDumpstateBoardFiles[] = { "dumpstate_board.txt", - // TODO: rename to dumpstate_board.bin once vendors can handle it - "modem_log_all.tar" + "dumpstate_board.bin" }; static const int NUM_OF_DUMPS = arraysize(kDumpstateBoardFiles); @@ -145,10 +144,12 @@ static const CommandOptions AS_ROOT_20 = CommandOptions::WithTimeout(20).AsRoot( * Returns a vector of dump fds under |dir_path| with a given |file_prefix|. * The returned vector is sorted by the mtimes of the dumps. If |limit_by_mtime| * is set, the vector only contains files that were written in the last 30 minutes. + * If |limit_by_count| is set, the vector only contains the ten latest files. */ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, const std::string& file_prefix, - bool limit_by_mtime) { + bool limit_by_mtime, + bool limit_by_count = true) { const time_t thirty_minutes_ago = ds.now_ - 60 * 30; std::unique_ptr<std::vector<DumpData>> dump_data(new std::vector<DumpData>()); @@ -191,6 +192,10 @@ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, std::sort(dump_data->begin(), dump_data->end()); + if (limit_by_count && dump_data->size() > 10) { + dump_data->erase(dump_data->begin() + 10, dump_data->end()); + } + return dump_data.release(); } |