| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const CpuProfileNode* GetTopDownRoot() const; | 133 const CpuProfileNode* GetTopDownRoot() const; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Interface for controlling CPU profiling. | 138 * Interface for controlling CPU profiling. |
| 139 */ | 139 */ |
| 140 class V8EXPORT CpuProfiler { | 140 class V8EXPORT CpuProfiler { |
| 141 public: | 141 public: |
| 142 /** | 142 /** |
| 143 * A note on security tokens usage. As scripts from different |
| 144 * origins can run inside a single V8 instance, it is possible to |
| 145 * have functions from different security contexts intermixed in a |
| 146 * single CPU profile. To avoid exposing function names belonging to |
| 147 * other contexts, filtering by security token is performed while |
| 148 * obtaining profiling results. |
| 149 */ |
| 150 |
| 151 /** |
| 143 * Returns the number of profiles collected (doesn't include | 152 * Returns the number of profiles collected (doesn't include |
| 144 * profiles that are being collected at the moment of call.) | 153 * profiles that are being collected at the moment of call.) |
| 145 */ | 154 */ |
| 146 static int GetProfilesCount(); | 155 static int GetProfilesCount(); |
| 147 | 156 |
| 148 /** Returns a profile by index. */ | 157 /** Returns a profile by index. */ |
| 149 static const CpuProfile* GetProfile(int index); | 158 static const CpuProfile* GetProfile( |
| 159 int index, |
| 160 Handle<Value> security_token = Handle<Value>()); |
| 150 | 161 |
| 151 /** Returns a profile by uid. */ | 162 /** Returns a profile by uid. */ |
| 152 static const CpuProfile* FindProfile(unsigned uid); | 163 static const CpuProfile* FindProfile( |
| 164 unsigned uid, |
| 165 Handle<Value> security_token = Handle<Value>()); |
| 153 | 166 |
| 154 /** | 167 /** |
| 155 * Starts collecting CPU profile. Title may be an empty string. It | 168 * Starts collecting CPU profile. Title may be an empty string. It |
| 156 * is allowed to have several profiles being collected at | 169 * is allowed to have several profiles being collected at |
| 157 * once. Attempts to start collecting several profiles with the same | 170 * once. Attempts to start collecting several profiles with the same |
| 158 * title are silently ignored. | 171 * title are silently ignored. While collecting a profile, functions |
| 172 * from all security contexts are included in it. The token-based |
| 173 * filtering is only performed when querying for a profile. |
| 159 */ | 174 */ |
| 160 static void StartProfiling(Handle<String> title); | 175 static void StartProfiling(Handle<String> title); |
| 161 | 176 |
| 162 /** | 177 /** |
| 163 * Stops collecting CPU profile with a given title and returns it. | 178 * Stops collecting CPU profile with a given title and returns it. |
| 164 * If the title given is empty, finishes the last profile started. | 179 * If the title given is empty, finishes the last profile started. |
| 165 */ | 180 */ |
| 166 static const CpuProfile* StopProfiling(Handle<String> title); | 181 static const CpuProfile* StopProfiling( |
| 182 Handle<String> title, |
| 183 Handle<Value> security_token = Handle<Value>()); |
| 167 }; | 184 }; |
| 168 | 185 |
| 169 | 186 |
| 170 } // namespace v8 | 187 } // namespace v8 |
| 171 | 188 |
| 172 | 189 |
| 173 #undef V8EXPORT | 190 #undef V8EXPORT |
| 174 | 191 |
| 175 | 192 |
| 176 #endif // V8_V8_PROFILER_H_ | 193 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |