| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c1e4f73 commit 2897cc1
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,16 +63,10 @@ static const char* get_dir_func_name_by_type(uv_fs_type req_type) { | |||
| 63 | 63 | #define GET_TRACE_ENABLED \ | |
| 64 | 64 | (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( \ | |
| 65 | 65 | TRACING_CATEGORY_NODE2(fs_dir, sync)) != 0) | |
| 66 | - #define FS_DIR_SYNC_TRACE_BEGIN(syscall, ...) \ | ||
| 67 | - if (GET_TRACE_ENABLED) \ | ||
| 68 | - TRACE_EVENT_BEGIN(TRACING_CATEGORY_NODE2(fs_dir, sync), \ | ||
| 69 | - TRACE_NAME(syscall), \ | ||
| 70 | - ##__VA_ARGS__); | ||
| 71 | - #define FS_DIR_SYNC_TRACE_END(syscall, ...) \ | ||
| 72 | - if (GET_TRACE_ENABLED) \ | ||
| 73 | - TRACE_EVENT_END(TRACING_CATEGORY_NODE2(fs_dir, sync), \ | ||
| 74 | - TRACE_NAME(syscall), \ | ||
| 75 | - ##__VA_ARGS__); | ||
| 66 | + #define FS_DIR_SYNC_TRACE(syscall) \ | ||
| 67 | + if (GET_TRACE_ENABLED) { \ | ||
| 68 | + TRACE_EVENT0(TRACING_CATEGORY_NODE2(fs_dir, sync), TRACE_NAME(syscall)); \ | ||
| 69 | + } | ||
| 76 | 70 | ||
| 77 | 71 | #define FS_DIR_ASYNC_TRACE_BEGIN0(fs_type, id) \ | |
| 78 | 72 | TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(TRACING_CATEGORY_NODE2(fs_dir, async), \ | |
@@ -138,9 +132,11 @@ void DirHandle::MemoryInfo(MemoryTracker* tracker) const { | |||
| 138 | 132 | inline void DirHandle::GCClose() { | |
| 139 | 133 | if (closed_) return; | |
| 140 | 134 | uv_fs_t req; | |
| 141 | - FS_DIR_SYNC_TRACE_BEGIN(closedir); | ||
| 142 | - int ret = uv_fs_closedir(nullptr, &req, dir_, nullptr); | ||
| 143 | - FS_DIR_SYNC_TRACE_END(closedir); | ||
| 135 | + int ret; | ||
| 136 | + { | ||
| 137 | + FS_DIR_SYNC_TRACE(closedir); | ||
| 138 | + ret = uv_fs_closedir(nullptr, &req, dir_, nullptr); | ||
| 139 | + } | ||
| 144 | 140 | uv_fs_req_cleanup(&req); | |
| 145 | 141 | closing_ = false; | |
| 146 | 142 | closed_ = true; | |
@@ -201,9 +197,8 @@ void DirHandle::Close(const FunctionCallbackInfo<Value>& args) { | |||
| 201 | 197 | uv_fs_closedir, dir->dir()); | |
| 202 | 198 | } else { // close() | |
| 203 | 199 | FSReqWrapSync req_wrap_sync("closedir"); | |
| 204 | - FS_DIR_SYNC_TRACE_BEGIN(closedir); | ||
| 200 | + FS_DIR_SYNC_TRACE(closedir); | ||
| 205 | 201 | SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_closedir, dir->dir()); | |
| 206 | - FS_DIR_SYNC_TRACE_END(closedir); | ||
| 207 | 202 | } | |
| 208 | 203 | } | |
| 209 | 204 | ||
@@ -299,10 +294,12 @@ void DirHandle::Read(const FunctionCallbackInfo<Value>& args) { | |||
| 299 | 294 | AfterDirRead, uv_fs_readdir, dir->dir()); | |
| 300 | 295 | } else { // dir.read(encoding, bufferSize) | |
| 301 | 296 | FSReqWrapSync req_wrap_sync("readdir"); | |
| 302 | - FS_DIR_SYNC_TRACE_BEGIN(readdir); | ||
| 303 | - int err = | ||
| 304 | - SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_readdir, dir->dir()); | ||
| 305 | - FS_DIR_SYNC_TRACE_END(readdir); | ||
| 297 | + int err; | ||
| 298 | + { | ||
| 299 | + FS_DIR_SYNC_TRACE(readdir); | ||
| 300 | + err = SyncCallAndThrowOnError( | ||
| 301 | + env, &req_wrap_sync, uv_fs_readdir, dir->dir()); | ||
| 302 | + } | ||
| 306 | 303 | if (err < 0) { | |
| 307 | 304 | return; // syscall failed, no need to continue, error is already thrown | |
| 308 | 305 | } | |
@@ -377,10 +374,12 @@ static void OpenDir(const FunctionCallbackInfo<Value>& args) { | |||
| 377 | 374 | THROW_IF_INSUFFICIENT_PERMISSIONS( | |
| 378 | 375 | env, permission::PermissionScope::kFileSystemRead, path.ToStringView()); | |
| 379 | 376 | FSReqWrapSync req_wrap_sync("opendir", *path); | |
| 380 | - FS_DIR_SYNC_TRACE_BEGIN(opendir); | ||
| 381 | - int result = | ||
| 382 | - SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_opendir, *path); | ||
| 383 | - FS_DIR_SYNC_TRACE_END(opendir); | ||
| 377 | + int result; | ||
| 378 | + { | ||
| 379 | + FS_DIR_SYNC_TRACE(opendir); | ||
| 380 | + result = | ||
| 381 | + SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_opendir, *path); | ||
| 382 | + } | ||
| 384 | 383 | if (result < 0) { | |
| 385 | 384 | return; // syscall failed, no need to continue, error is already thrown | |
| 386 | 385 | } | |
@@ -407,9 +406,11 @@ static void OpenDirSync(const FunctionCallbackInfo<Value>& args) { | |||
| 407 | 406 | ||
| 408 | 407 | uv_fs_t req; | |
| 409 | 408 | auto make = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); }); | |
| 410 | - FS_DIR_SYNC_TRACE_BEGIN(opendir); | ||
| 411 | - int err = uv_fs_opendir(nullptr, &req, *path, nullptr); | ||
| 412 | - FS_DIR_SYNC_TRACE_END(opendir); | ||
| 409 | + int err; | ||
| 410 | + { | ||
| 411 | + FS_DIR_SYNC_TRACE(opendir); | ||
| 412 | + err = uv_fs_opendir(nullptr, &req, *path, nullptr); | ||
| 413 | + } | ||
| 413 | 414 | if (err < 0) { | |
| 414 | 415 | return env->ThrowUVException(err, "opendir"); | |
| 415 | 416 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,10 +153,16 @@ static const char* get_fs_func_name_by_type(uv_fs_type req_type) { | |||
| 153 | 153 | if (GET_TRACE_ENABLED) \ | |
| 154 | 154 | TRACE_EVENT_BEGIN( \ | |
| 155 | 155 | TRACING_CATEGORY_NODE2(fs, sync), TRACE_NAME(syscall), ##__VA_ARGS__); | |
| 156 | + #ifdef V8_USE_PERFETTO | ||
| 157 | + #define FS_SYNC_TRACE_END(syscall, ...) \ | ||
| 158 | + if (GET_TRACE_ENABLED) \ | ||
| 159 | + TRACE_EVENT_END(TRACING_CATEGORY_NODE2(fs, sync), ##__VA_ARGS__); | ||
| 160 | + #else | ||
| 156 | 161 | #define FS_SYNC_TRACE_END(syscall, ...) \ | |
| 157 | 162 | if (GET_TRACE_ENABLED) \ | |
| 158 | 163 | TRACE_EVENT_END( \ | |
| 159 | 164 | TRACING_CATEGORY_NODE2(fs, sync), TRACE_NAME(syscall), ##__VA_ARGS__); | |
| 165 | + #endif | ||
| 160 | 166 | ||
| 161 | 167 | #define FS_ASYNC_TRACE_BEGIN0(fs_type, id) \ | |
| 162 | 168 | TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(TRACING_CATEGORY_NODE2(fs, async), \ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments