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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h

Issue 215553002: Report some PNaCl UMA earlier, instead of in one chunk at the end. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 namespace plugin { 27 namespace plugin {
28 28
29 class Manifest; 29 class Manifest;
30 class NaClSubprocess; 30 class NaClSubprocess;
31 class Plugin; 31 class Plugin;
32 class PnaclCoordinator; 32 class PnaclCoordinator;
33 class PnaclOptions; 33 class PnaclOptions;
34 class PnaclResources; 34 class PnaclResources;
35 class TempFile; 35 class TempFile;
36 36
37 struct PnaclTimeStats {
38 int64_t pnacl_llc_load_time;
39 int64_t pnacl_compile_time;
40 int64_t pnacl_ld_load_time;
41 int64_t pnacl_link_time;
42 };
43
44 class PnaclTranslateThread { 37 class PnaclTranslateThread {
45 public: 38 public:
46 PnaclTranslateThread(); 39 PnaclTranslateThread();
47 ~PnaclTranslateThread(); 40 ~PnaclTranslateThread();
48 41
49 // Start the translation process. It will continue to run and consume data 42 // Start the translation process. It will continue to run and consume data
50 // as it is passed in with PutBytes. 43 // as it is passed in with PutBytes.
51 void RunTranslate(const pp::CompletionCallback& finish_callback, 44 void RunTranslate(const pp::CompletionCallback& finish_callback,
52 const Manifest* manifest, 45 const Manifest* manifest,
53 const std::vector<TempFile*>* obj_files, 46 const std::vector<TempFile*>* obj_files,
54 TempFile* nexe_file, 47 TempFile* nexe_file,
55 nacl::DescWrapper* invalid_desc_wrapper, 48 nacl::DescWrapper* invalid_desc_wrapper,
56 ErrorInfo* error_info, 49 ErrorInfo* error_info,
57 PnaclResources* resources, 50 PnaclResources* resources,
58 PnaclOptions* pnacl_options, 51 PnaclOptions* pnacl_options,
59 PnaclCoordinator* coordinator, 52 PnaclCoordinator* coordinator,
60 Plugin* plugin); 53 Plugin* plugin);
61 54
62 // Kill the llc and/or ld subprocesses. This happens by closing the command 55 // Kill the llc and/or ld subprocesses. This happens by closing the command
63 // channel on the plugin side, which causes the trusted code in the nexe to 56 // channel on the plugin side, which causes the trusted code in the nexe to
64 // exit, which will cause any pending SRPCs to error. Because this is called 57 // exit, which will cause any pending SRPCs to error. Because this is called
65 // on the main thread, the translation thread must not use the subprocess 58 // on the main thread, the translation thread must not use the subprocess
66 // objects without the lock, other than InvokeSrpcMethod, which does not 59 // objects without the lock, other than InvokeSrpcMethod, which does not
67 // race with service runtime shutdown. 60 // race with service runtime shutdown.
68 void AbortSubprocesses(); 61 void AbortSubprocesses();
69 62
70 // Send bitcode bytes to the translator. Called from the main thread. 63 // Send bitcode bytes to the translator. Called from the main thread.
71 void PutBytes(std::vector<char>* data, int count); 64 void PutBytes(std::vector<char>* data, int count);
72 65
73 const PnaclTimeStats& GetTimeStats() const { return time_stats_; } 66 int64_t GetCompileTime() const { return compile_time_; }
74 67
75 private: 68 private:
76 // Starts an individual llc or ld subprocess used for translation. 69 // Starts an individual llc or ld subprocess used for translation.
77 NaClSubprocess* StartSubprocess(const nacl::string& url, 70 NaClSubprocess* StartSubprocess(const nacl::string& url,
78 const Manifest* manifest, 71 const Manifest* manifest,
79 ErrorInfo* error_info); 72 ErrorInfo* error_info);
80 // Helper thread entry point for translation. Takes a pointer to 73 // Helper thread entry point for translation. Takes a pointer to
81 // PnaclTranslateThread and calls DoTranslate(). 74 // PnaclTranslateThread and calls DoTranslate().
82 static void WINAPI DoTranslateThread(void* arg); 75 static void WINAPI DoTranslateThread(void* arg);
83 // Runs the streaming translation. Called from the helper thread. 76 // Runs the streaming translation. Called from the helper thread.
(...skipping 26 matching lines...) Expand all
110 struct NaClCondVar buffer_cond_; 103 struct NaClCondVar buffer_cond_;
111 // Mutex for buffer_cond_. 104 // Mutex for buffer_cond_.
112 struct NaClMutex cond_mu_; 105 struct NaClMutex cond_mu_;
113 // Data buffers from FileDownloader are enqueued here to pass from the 106 // Data buffers from FileDownloader are enqueued here to pass from the
114 // main thread to the SRPC thread. Protected by cond_mu_ 107 // main thread to the SRPC thread. Protected by cond_mu_
115 std::deque<std::vector<char> > data_buffers_; 108 std::deque<std::vector<char> > data_buffers_;
116 // Whether all data has been downloaded and copied to translation thread. 109 // Whether all data has been downloaded and copied to translation thread.
117 // Associated with buffer_cond_ 110 // Associated with buffer_cond_
118 bool done_; 111 bool done_;
119 112
120 PnaclTimeStats time_stats_; 113 int64_t compile_time_;
121 114
122 // Data about the translation files, owned by the coordinator 115 // Data about the translation files, owned by the coordinator
123 const Manifest* manifest_; 116 const Manifest* manifest_;
124 const std::vector<TempFile*>* obj_files_; 117 const std::vector<TempFile*>* obj_files_;
125 TempFile* nexe_file_; 118 TempFile* nexe_file_;
126 nacl::DescWrapper* invalid_desc_wrapper_; 119 nacl::DescWrapper* invalid_desc_wrapper_;
127 ErrorInfo* coordinator_error_info_; 120 ErrorInfo* coordinator_error_info_;
128 PnaclResources* resources_; 121 PnaclResources* resources_;
129 PnaclOptions* pnacl_options_; 122 PnaclOptions* pnacl_options_;
130 PnaclCoordinator* coordinator_; 123 PnaclCoordinator* coordinator_;
131 Plugin* plugin_; 124 Plugin* plugin_;
132 private: 125 private:
133 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); 126 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread);
134 }; 127 };
135 128
136 } 129 }
137 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ 130 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698