Skip to content

Commit e79b5fc

Browse files
authored
fix: remove logging.json from profiling results (#5135)
1 parent 562d4a1 commit e79b5fc

File tree

4 files changed

+3
-26
lines changed

4 files changed

+3
-26
lines changed

e2e/cases/rspack-profile/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ rspackOnlyTest(
8282
expect(
8383
fs.existsSync(path.join(profileDir!, 'jscpuprofile.json')),
8484
).toBeTruthy();
85-
expect(fs.existsSync(path.join(profileDir!, 'logging.json'))).toBeTruthy();
8685

8786
buildProcess.kill();
8887
},

packages/core/src/plugins/rspackProfile.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const pluginRspackProfile = (): RsbuildPlugin => ({
3232

3333
/**
3434
* RSPACK_PROFILE=ALL
35-
* RSPACK_PROFILE=TRACE|CPU|LOGGING
35+
* RSPACK_PROFILE=TRACE|CPU
3636
*/
3737
const RSPACK_PROFILE = process.env.RSPACK_PROFILE?.toUpperCase();
3838

@@ -51,9 +51,6 @@ export const pluginRspackProfile = (): RsbuildPlugin => ({
5151
const enableCPUProfile =
5252
RSPACK_PROFILE === 'ALL' || RSPACK_PROFILE.includes('CPU');
5353

54-
const enableLogging =
55-
RSPACK_PROFILE === 'ALL' || RSPACK_PROFILE.includes('LOGGING');
56-
5754
const onStart = async () => {
5855
// Note: Cannot obtain accurate `api.context.distPath` before config initialization
5956
const profileDir = path.join(api.context.distPath, profileDirName);
@@ -87,23 +84,6 @@ export const pluginRspackProfile = (): RsbuildPlugin => ({
8784
});
8885
api.onBeforeStartDevServer(onStart);
8986

90-
api.onAfterBuild(async ({ stats }) => {
91-
const loggingFilePath = path.join(
92-
api.context.distPath,
93-
profileDirName,
94-
'logging.json',
95-
);
96-
97-
if (enableLogging && stats) {
98-
const logging = stats.toJson({
99-
all: false,
100-
logging: 'verbose',
101-
loggingTrace: true,
102-
});
103-
await fs.promises.writeFile(loggingFilePath, JSON.stringify(logging));
104-
}
105-
});
106-
10787
api.onExit(() => {
10888
if (enableProfileTrace) {
10989
rspack.experiments.globalTrace.cleanup();

website/docs/en/guide/debug/build-profiling.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ As Windows does not support the above usage, you can also use [cross-env](https:
6262
}
6363
```
6464

65-
When the build command is finished, or the dev server is shutdown, Rsbuild will generate a `rspack-profile-${timestamp}` folder in the dist folder, and it will contain `logging.json`, `trace.json` and `jscpuprofile.json` files:
65+
When the build command is finished, or the dev server is shutdown, Rsbuild will generate a `rspack-profile-${timestamp}` folder in the dist folder, and it will contain `trace.json` and `jscpuprofile.json` files:
6666

6767
- `trace.json`: The time spent on each phase of the Rust side is recorded at a granular level using tracing and can be viewed using [ui.perfetto.dev](https://ui.perfetto.dev/).
6868
- `jscpuprofile.json`: The time spent at each stage on the JavaScript side is recorded at a granular level using [Node.js inspector](https://nodejs.org/dist/latest-v18.x/docs/api/inspector.html) and can be viewed using [speedscope.app](https://www.speedscope.app/).
69-
- `logging.json`: Includes some logging information that keeps a coarse-grained record of how long each phase of the build took. (Not supported in development mode yet)
7069

7170
:::tip
7271
For more information about Rspack build profiling, refer to [Rspack - Profiling](https://rspack.dev/contribute/development/profiling).

website/docs/zh/guide/debug/build-profiling.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ Rsbuild 支持使用 `RSPACK_PROFILE` 环境变量来对 Rspack 进行构建性
6262
}
6363
```
6464

65-
当 build 命令执行完成,或是 dev server 被关闭时,Rsbuild 会在产物目录下生成一个 `rspack-profile-${timestamp}` 文件夹,该文件夹下会包含 `logging.json``trace.json``jscpuprofile.json` 三个文件
65+
当 build 命令执行完成,或是 dev server 被关闭时,Rsbuild 会在产物目录下生成一个 `rspack-profile-${timestamp}` 文件夹,该文件夹下会包含 `trace.json``jscpuprofile.json` 文件
6666

6767
- `trace.json`:使用 tracing 细粒度地记录了 Rust 侧各个阶段的耗时,可以使用 [ui.perfetto.dev](https://ui.perfetto.dev/) 进行查看。
6868
- `jscpuprofile.json`:使用 [Node.js inspector](https://nodejs.org/dist/latest-v18.x/docs/api/inspector.html) 细粒度地记录了 JavaScript 侧的各个阶段的耗时,可以使用 [speedscope.app](https://www.speedscope.app/) 进行查看。
69-
- `logging.json`:包含一些日志信息,粗粒度地记录了构建的各个阶段耗时(开发模式下暂不支持)。
7069

7170
:::tip
7271
关于 Rspack 构建性能分析的更多用法,可参考 [Rspack - Profiling](https://rspack.dev/contribute/development/profiling)

0 commit comments

Comments
 (0)