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

Side by Side Diff: components/browser_watcher/fetch_system_session_events_main_win.cc

Issue 2715903003: Bound the impact of system instability on chrome instability. (Closed)
Patch Set: Merge fixups Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // A utility for testing locally the retrieval of system session events.
6
7 #include <iostream>
8
9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h"
11 #include "base/time/time.h"
12 #include "components/browser_watcher/system_session_analyzer_win.h"
13
14 namespace {
15
16 using browser_watcher::SystemSessionAnalyzer;
17
18 class SystemSessionEventFetcher : public SystemSessionAnalyzer {
19 public:
20 explicit SystemSessionEventFetcher(uint32_t session_cnt)
21 : SystemSessionAnalyzer(session_cnt) {}
22 using SystemSessionAnalyzer::FetchEvents;
23 };
24
25 } // namespace
26
27 int main(int argc, char** argv) {
28 // Retrieve events for the last 5 sessions.
29 SystemSessionEventFetcher fetcher(5U);
30 std::vector<SystemSessionEventFetcher::EventInfo> events;
31 if (!fetcher.FetchEvents(&events)) {
32 std::cerr << "Failed to fetch events." << std::endl;
33 return 1;
34 }
35
36 // Print the event ids and times.
37 for (const SystemSessionEventFetcher::EventInfo& event : events) {
38 base::Time::Exploded exploded = {};
39 event.event_time.LocalExplode(&exploded);
40 std::string time = base::StringPrintf(
41 "%d/%d/%d %d:%02d:%02d", exploded.month, exploded.day_of_month,
42 exploded.year, exploded.hour, exploded.minute, exploded.second);
43 std::cout << "Event: " << event.event_id << " (" << time << ")"
44 << std::endl;
45 }
46
47 return 0;
48 }
OLDNEW
« no previous file with comments | « components/browser_watcher/BUILD.gn ('k') | components/browser_watcher/postmortem_report_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698