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

Side by Side Diff: snapshot/process_snapshot.h

Issue 597673004: Add the Snapshot interface (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Make everything else const too Created 6 years, 2 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
« no previous file with comments | « snapshot/module_snapshot.h ('k') | snapshot/snapshot.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_
16 #define CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_
17
18 #include <sys/time.h>
19 #include <sys/types.h>
20
21 #include <vector>
22
23 namespace crashpad {
24
25 class ExceptionSnapshot;
26 class ModuleSnapshot;
27 class SystemSnapshot;
28 class ThreadSnapshot;
29
30 //! \brief An abstract interface to a snapshot representing the state of a
31 //! process.
32 //!
33 //! This is the top-level object in a family of Snapshot objects, because it
34 //! gives access to a SystemSnapshot, vectors of ModuleSnapshot and
35 //! ThreadSnapshot objects, and possibly an ExceptionSnapshot. In turn,
36 //! ThreadSnapshot and ExceptionSnapshot objects both give access to CPUContext
37 //! objects, and ThreadSnapshot objects also give access to MemorySnapshot
38 //! objects corresponding to thread stacks.
39 class ProcessSnapshot {
40 public:
41 //! \brief Returns the snapshot process’ process ID.
42 virtual pid_t ProcessID() const = 0;
43
44 //! \brief Returns the snapshot process’ parent process’ process ID.
45 virtual pid_t ParentProcessID() const = 0;
46
47 //! \brief Returns the time that the snapshot was taken in \a snapshot_time.
48 //!
49 //! \param[out] snapshot_time The time that the snapshot was taken. This is
50 //! distinct from the time that a ProcessSnapshot object was created or
51 //! initialized, although it may be that time for ProcessSnapshot objects
52 //! representing live or recently-crashed process state.
53 virtual void SnapshotTime(timeval* snapshot_time) const = 0;
54
55 //! \brief Returns the time that the snapshot process was started in \a
56 //! start_time.
57 //!
58 //! Normally, process uptime in wall clock time can be computed as
59 //! SnapshotTime() − ProcessStartTime(), but this cannot be guaranteed in
60 //! cases where the real-time clock has been set during the snapshot process’
61 //! lifetime.
62 //!
63 //! \param[out] start_time The time that the process was started.
64 virtual void ProcessStartTime(timeval* start_time) const = 0;
65
66 //! \brief Returns the snapshot process’ CPU usage times in \a user_time and
67 //! \a system_time.
68 //!
69 //! \param[out] user_time The time that the process has spent executing in
70 //! user mode.
71 //! \param[out] system_time The time that the process has spent executing in
72 //! system (kernel) mode.
73 virtual void ProcessCPUTimes(timeval* user_time,
74 timeval* system_time) const = 0;
75
76 //! \brief Returns a SystemSnapshot reflecting the characteristics of the
77 //! system that ran the snapshot process at the time of the snapshot.
78 //!
79 //! \return A SystemSnapshot object. The caller does not take ownership of
80 //! this object, it is scoped to the lifetime of the ProcessSnapshot
81 //! object that it was obtained from.
82 virtual const SystemSnapshot* System() const = 0;
83
84 //! \brief Returns ModuleSnapshot objects reflecting the code modules (binary
85 //! images) loaded into the snapshot process at the time of the snapshot.
86 //!
87 //! \return A vector of ModuleSnapshot objects. The caller does not take
88 //! ownership of these objects, they are scoped to the lifetime of the
89 //! ProcessSnapshot object that they were obtained from.
90 virtual std::vector<const ModuleSnapshot*> Modules() const = 0;
91
92 //! \brief Returns ThreadSnapshot objects reflecting the threads (lightweight
93 //! processes) existing in the snapshot process at the time of the
94 //! snapshot.
95 //!
96 //! \return A vector of ThreadSnapshot objects. The caller does not take
97 //! ownership of these objects, they are scoped to the lifetime of the
98 //! ProcessSnapshot object that they were obtained from.
99 virtual std::vector<const ThreadSnapshot*> Threads() const = 0;
100
101 //! \brief Returns an ExceptionSnapshot reflecting the exception that the
102 //! snapshot process sustained to trigger the snapshot being taken.
103 //!
104 //! \return An ExceptionSnapshot object. The caller does not take ownership of
105 //! this object, it is scoped to the lifetime of the ProcessSnapshot
106 //! object that it was obtained from. If the snapshot is not a result of
107 //! an exception, returns `NULL`.
108 virtual const ExceptionSnapshot* Exception() const = 0;
109
110 protected:
111 ~ProcessSnapshot() {}
112 };
113
114 } // namespace crashpad
115
116 #endif // CRASHPAD_SNAPSHOT_PROCESS_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « snapshot/module_snapshot.h ('k') | snapshot/snapshot.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698