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

Side by Side Diff: remoting/test/it2me_standalone_host_runner.cc

Issue 1923573006: Implement a dummy host to do capturing and analysis only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build break Created 4 years, 7 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 2016 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 #include <iostream>
6 #include <vector>
7
8 #include "base/at_exit.h"
9 #include "base/bind.h"
10 #include "base/command_line.h"
11 #include "base/logging.h"
12 #include "base/time/time.h"
13 #include "remoting/base/auto_thread_task_runner.h"
14 #include "remoting/host/resources.h"
15 #include "remoting/test/it2me_standalone_host.h"
16
17 #if defined(OS_LINUX)
18 #include <gtk/gtk.h>
19 #include <X11/Xlib.h>
20
21 #include "base/linux_util.h"
22 #endif // defined(OS_LINUX)
23
24 using remoting::test::It2MeStandaloneHost;
25
26 namespace {
27
28 void BindAnalysisResultOutputter(It2MeStandaloneHost* host);
29
30 void OutputLogger(const char* name,
31 const remoting::test::MessageCounter& counter) {
32 std::cout << name
33 << ": "
34 << counter.message_size()
35 << " bytes in "
36 << counter.message_count()
37 << " packages, last package "
38 << counter.last_message_size()
39 << " bytes, "
40 << counter.AverageMessageSize()
41 << " bytes/package, "
42 << counter.MessagesPerSecond()
43 << " packages/sec, "
44 << counter.SizePerSecond()
45 << " bytes/sec"
46 << std::endl;
47 }
48
49 void OutputAnalysisResult(It2MeStandaloneHost* host) {
50 OutputLogger("audio", host->audio_stub());
51 OutputLogger("video", host->video_stub());
52 OutputLogger("client", host->client_stub());
53 OutputLogger("host", host->host_stub());
joedow 2016/05/03 22:28:30 I do wonder if this log could go into a logging cl
Hzj_jie 2016/05/04 02:11:57 Done.
54 BindAnalysisResultOutputter(host);
55 }
56
57 void BindAnalysisResultOutputter(It2MeStandaloneHost* host) {
58 host->context().ui_task_runner()->PostDelayedTask(
59 FROM_HERE,
60 base::Bind(&OutputAnalysisResult, host),
61 base::TimeDelta::FromSeconds(1));
joedow 2016/05/03 22:28:30 Why not use a RepeatingTimer here?
Hzj_jie 2016/05/04 02:11:57 I do not know we have a RepeatingTimer before :)
62 }
63
64 } // namespace
65
66 int main(int argc, const char** argv) {
67 base::AtExitManager at_exit_manager;
68 base::CommandLine::Init(argc, argv);
69 It2MeStandaloneHost host;
70
71 #if defined(OS_LINUX)
72 // Required in order for us to run multiple X11 threads.
73 XInitThreads();
74
75 // Required for any calls into GTK functions, such as the Disconnect and
76 // Continue windows. Calling with nullptr arguments because we don't have
77 // any command line arguments for gtk to consume.
78 gtk_init(nullptr, nullptr);
79
80 // Need to prime the host OS version value for linux to prevent IO on the
81 // network thread. base::GetLinuxDistro() caches the result.
82 base::GetLinuxDistro();
83 #endif // OS_LINUX
84
85 DCHECK(remoting::LoadResources("en-US"));
joedow 2016/05/03 22:28:30 IIRC DCHECKS are removed completely on release bui
Hzj_jie 2016/05/04 02:11:57 Interesting, I believe I need this statement in bo
86 BindAnalysisResultOutputter(&host);
87 host.Run();
88 }
OLDNEW
« remoting/test/it2me_standalone_host.cc ('K') | « remoting/test/it2me_standalone_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698