| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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_PROCESS_SNAPSHOT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_ | 16 #define CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_ |
| 17 | 17 |
| 18 #include <sys/time.h> | 18 #include <sys/time.h> |
| 19 #include <sys/types.h> | 19 #include <sys/types.h> |
| 20 | 20 |
| 21 #include <map> |
| 22 #include <string> |
| 21 #include <vector> | 23 #include <vector> |
| 22 | 24 |
| 23 namespace crashpad { | 25 namespace crashpad { |
| 24 | 26 |
| 25 class ExceptionSnapshot; | 27 class ExceptionSnapshot; |
| 26 class ModuleSnapshot; | 28 class ModuleSnapshot; |
| 27 class SystemSnapshot; | 29 class SystemSnapshot; |
| 28 class ThreadSnapshot; | 30 class ThreadSnapshot; |
| 29 | 31 |
| 30 //! \brief An abstract interface to a snapshot representing the state of a | 32 //! \brief An abstract interface to a snapshot representing the state of a |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 //! \brief Returns the snapshot process’ CPU usage times in \a user_time and | 70 //! \brief Returns the snapshot process’ CPU usage times in \a user_time and |
| 69 //! \a system_time. | 71 //! \a system_time. |
| 70 //! | 72 //! |
| 71 //! \param[out] user_time The time that the process has spent executing in | 73 //! \param[out] user_time The time that the process has spent executing in |
| 72 //! user mode. | 74 //! user mode. |
| 73 //! \param[out] system_time The time that the process has spent executing in | 75 //! \param[out] system_time The time that the process has spent executing in |
| 74 //! system (kernel) mode. | 76 //! system (kernel) mode. |
| 75 virtual void ProcessCPUTimes(timeval* user_time, | 77 virtual void ProcessCPUTimes(timeval* user_time, |
| 76 timeval* system_time) const = 0; | 78 timeval* system_time) const = 0; |
| 77 | 79 |
| 80 //! \brief Returns key-value string annotations recorded for the process, |
| 81 //! system, or snapshot producer. |
| 82 //! |
| 83 //! This method retrieves annotations recorded for a process. These |
| 84 //! annotations are intended for diagnostic use, including crash analysis. |
| 85 //! “Simple annotations” are structured as a sequence of key-value pairs, |
| 86 //! where all keys and values are strings. These are referred to in Chrome as |
| 87 //! “crash keys.” |
| 88 //! |
| 89 //! Annotations stored here may reflect the process, system, or snapshot |
| 90 //! producer. Most annotations not under the client’s direct control will be |
| 91 //! retrievable by this method. For clients such as Chrome, this includes the |
| 92 //! product name and version. |
| 93 //! |
| 94 //! Additional per-module annotations may be obtained by calling |
| 95 //! ModuleSnapshot::AnnotationsSimpleMap(). |
| 96 // |
| 97 // This interface currently returns a const& because all implementations store |
| 98 // the data within their objects in this format, and are therefore able to |
| 99 // provide this access without requiring a copy. Future implementations may |
| 100 // obtain data on demand or store data in a different format, at which point |
| 101 // the cost of maintaining this data in ProcessSnapshot subclass objects will |
| 102 // need to be taken into account, and this interface possibly revised. |
| 103 virtual const std::map<std::string, std::string>& AnnotationsSimpleMap() |
| 104 const = 0; |
| 105 |
| 78 //! \brief Returns a SystemSnapshot reflecting the characteristics of the | 106 //! \brief Returns a SystemSnapshot reflecting the characteristics of the |
| 79 //! system that ran the snapshot process at the time of the snapshot. | 107 //! system that ran the snapshot process at the time of the snapshot. |
| 80 //! | 108 //! |
| 81 //! \return A SystemSnapshot object. The caller does not take ownership of | 109 //! \return A SystemSnapshot object. The caller does not take ownership of |
| 82 //! this object, it is scoped to the lifetime of the ProcessSnapshot | 110 //! this object, it is scoped to the lifetime of the ProcessSnapshot |
| 83 //! object that it was obtained from. | 111 //! object that it was obtained from. |
| 84 virtual const SystemSnapshot* System() const = 0; | 112 virtual const SystemSnapshot* System() const = 0; |
| 85 | 113 |
| 86 //! \brief Returns ModuleSnapshot objects reflecting the code modules (binary | 114 //! \brief Returns ModuleSnapshot objects reflecting the code modules (binary |
| 87 //! images) loaded into the snapshot process at the time of the snapshot. | 115 //! images) loaded into the snapshot process at the time of the snapshot. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 106 //! \return An ExceptionSnapshot object. The caller does not take ownership of | 134 //! \return An ExceptionSnapshot object. The caller does not take ownership of |
| 107 //! this object, it is scoped to the lifetime of the ProcessSnapshot | 135 //! this object, it is scoped to the lifetime of the ProcessSnapshot |
| 108 //! object that it was obtained from. If the snapshot is not a result of | 136 //! object that it was obtained from. If the snapshot is not a result of |
| 109 //! an exception, returns `nullptr`. | 137 //! an exception, returns `nullptr`. |
| 110 virtual const ExceptionSnapshot* Exception() const = 0; | 138 virtual const ExceptionSnapshot* Exception() const = 0; |
| 111 }; | 139 }; |
| 112 | 140 |
| 113 } // namespace crashpad | 141 } // namespace crashpad |
| 114 | 142 |
| 115 #endif // CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_ | 143 #endif // CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_ |
| OLD | NEW |