OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
17 | 17 |
| 18 #include <sys/time.h> |
18 #include <windows.h> | 19 #include <windows.h> |
19 | 20 |
20 #include "util/misc/initialization_state_dcheck.h" | 21 #include "util/misc/initialization_state_dcheck.h" |
21 #include "util/win/address_types.h" | 22 #include "util/win/address_types.h" |
22 #include "util/win/process_info.h" | 23 #include "util/win/process_info.h" |
23 | 24 |
24 namespace crashpad { | 25 namespace crashpad { |
25 | 26 |
26 //! \brief Accesses information about another process, identified by a HANDLE. | 27 //! \brief Accesses information about another process, identified by a HANDLE. |
27 class ProcessReaderWin { | 28 class ProcessReaderWin { |
(...skipping 13 matching lines...) Expand all Loading... |
41 bool Initialize(HANDLE process); | 42 bool Initialize(HANDLE process); |
42 | 43 |
43 //! \return `true` if the target task is a 64-bit process. | 44 //! \return `true` if the target task is a 64-bit process. |
44 bool Is64Bit() const { return process_info_.Is64Bit(); } | 45 bool Is64Bit() const { return process_info_.Is64Bit(); } |
45 | 46 |
46 pid_t ProcessID() const { return process_info_.ProcessID(); } | 47 pid_t ProcessID() const { return process_info_.ProcessID(); } |
47 pid_t ParentProcessID() const { return process_info_.ParentProcessID(); } | 48 pid_t ParentProcessID() const { return process_info_.ParentProcessID(); } |
48 | 49 |
49 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into); | 50 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into); |
50 | 51 |
| 52 //! \brief Determines the target process' start time. |
| 53 //! |
| 54 //! \param[out] start_time The time that the process started. |
| 55 //! |
| 56 //! \return `true` on success, `false` on failure, with a warning logged. |
| 57 bool StartTime(timeval* start_time) const; |
| 58 |
| 59 //! \brief Determines the target process' execution time. |
| 60 //! |
| 61 //! \param[out] user_time The amount of time the process has executed code in |
| 62 //! user mode. |
| 63 //! \param[out] system_time The amount of time the process has executed code |
| 64 //! in kernel mode. |
| 65 //! |
| 66 //! \return `true` on success, `false` on failure, with a warning logged. |
| 67 bool CPUTimes(timeval* user_time, timeval* system_time) const; |
| 68 |
51 //! \return The modules loaded in the process. The first element (at index | 69 //! \return The modules loaded in the process. The first element (at index |
52 //! `0`) corresponds to the main executable. | 70 //! `0`) corresponds to the main executable. |
53 const std::vector<ProcessInfo::Module>& Modules(); | 71 const std::vector<ProcessInfo::Module>& Modules(); |
54 | 72 |
55 private: | 73 private: |
56 HANDLE process_; | 74 HANDLE process_; |
57 ProcessInfo process_info_; | 75 ProcessInfo process_info_; |
58 std::vector<ProcessInfo::Module> modules_; | 76 std::vector<ProcessInfo::Module> modules_; |
59 InitializationStateDcheck initialized_; | 77 InitializationStateDcheck initialized_; |
60 | 78 |
61 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); | 79 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); |
62 }; | 80 }; |
63 | 81 |
64 } // namespace crashpad | 82 } // namespace crashpad |
65 | 83 |
66 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 84 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
OLD | NEW |