@simplysm/sd-cli 12.11.28 → 12.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sd-cli.js +35 -12
- package/dist/sd-cli.js.map +1 -1
- package/package.json +12 -12
- package/src/sd-cli.ts +39 -12
package/dist/sd-cli.js
CHANGED
|
@@ -9,7 +9,7 @@ const cliPath = import.meta.resolve("./sd-cli-entry");
|
|
|
9
9
|
if (path.extname(cliPath) === ".ts") {
|
|
10
10
|
// .ts 바로실행 (개발)
|
|
11
11
|
// 현재 프로세스에 affinity 적용
|
|
12
|
-
|
|
12
|
+
configureProcessorAffinityAndPriority(process.pid);
|
|
13
13
|
await import(cliPath);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
@@ -26,6 +26,9 @@ else {
|
|
|
26
26
|
const child = spawn("node", [
|
|
27
27
|
"--import=specifier-resolution-node/register",
|
|
28
28
|
"--max-old-space-size=8192",
|
|
29
|
+
"--initial-old-space-size=2048",
|
|
30
|
+
"--max-semi-space-size=128",
|
|
31
|
+
"--stack-size=8192",
|
|
29
32
|
fileURLToPath(cliPath),
|
|
30
33
|
...process.argv.slice(2),
|
|
31
34
|
], { stdio: "inherit" });
|
|
@@ -33,30 +36,50 @@ else {
|
|
|
33
36
|
child.on("spawn", () => {
|
|
34
37
|
if (child.pid == null)
|
|
35
38
|
return;
|
|
36
|
-
|
|
39
|
+
configureProcessorAffinityAndPriority(child.pid);
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
|
-
function
|
|
40
|
-
// 논리 CPU 수 기반 affinity mask 계산 (전체 - 1)
|
|
42
|
+
function configureProcessorAffinityAndPriority(pid) {
|
|
41
43
|
const cpuCount = os.cpus().length;
|
|
42
44
|
const affinityMask = calculateAffinityMask(cpuCount);
|
|
43
|
-
const
|
|
45
|
+
const commands = [
|
|
46
|
+
`$p = Get-Process -Id ${pid}`,
|
|
47
|
+
`$p.ProcessorAffinity = ${affinityMask}`,
|
|
48
|
+
`$p.PriorityClass = 'BelowNormal'`,
|
|
49
|
+
].join("; ");
|
|
50
|
+
const command = `powershell -Command "${commands}"`;
|
|
44
51
|
exec(command, (err) => {
|
|
45
52
|
if (err) {
|
|
46
|
-
console.error("Affinity 설정 실패:", err.message);
|
|
53
|
+
console.error("Affinity 또는 우선순위 설정 실패:", err.message);
|
|
47
54
|
}
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
|
-
// ProcessorAffinity 마스크 계산
|
|
57
|
+
// ProcessorAffinity 마스크 계산 (앞 코어 빼기)
|
|
51
58
|
function calculateAffinityMask(cpuCount) {
|
|
52
|
-
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount /
|
|
53
|
-
const
|
|
54
|
-
|
|
59
|
+
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 4); // 예: 4개당 1개 제외
|
|
60
|
+
const usableStart = exclude;
|
|
61
|
+
const usableEnd = cpuCount;
|
|
62
|
+
if (usableEnd - usableStart <= 0) {
|
|
55
63
|
throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
56
64
|
}
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
let mask = 0n;
|
|
66
|
+
for (let i = usableStart; i < usableEnd; i++) {
|
|
67
|
+
mask |= 1n << BigInt(i);
|
|
68
|
+
}
|
|
69
|
+
return "0x" + mask.toString(16).toUpperCase();
|
|
59
70
|
}
|
|
71
|
+
// ProcessorAffinity 마스크 계산 (뒤 코어 빼기)
|
|
72
|
+
// function calculateAffinityMask(cpuCount: number): string {
|
|
73
|
+
// const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 8); // 8개당 1개씩 뺌
|
|
74
|
+
// const usable = cpuCount - exclude;
|
|
75
|
+
//
|
|
76
|
+
// if (usable <= 0) {
|
|
77
|
+
// throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
78
|
+
// }
|
|
79
|
+
//
|
|
80
|
+
// const maskValue = (1 << usable) - 1;
|
|
81
|
+
// return "0x" + maskValue.toString(16).toUpperCase();
|
|
82
|
+
// }
|
|
60
83
|
async function spawnWaitAsync(command, args) {
|
|
61
84
|
await new Promise((resolve) => {
|
|
62
85
|
const child = spawn(command, args, {
|
package/dist/sd-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-cli.js","sourceRoot":"","sources":["../src/sd-cli.ts"],"names":[],"mappings":";AAEA,+BAA+B;AAE/B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,YAAY;AACZ,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEtD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE,CAAC;IACpC,gBAAgB;IAEhB,uBAAuB;IACvB,
|
|
1
|
+
{"version":3,"file":"sd-cli.js","sourceRoot":"","sources":["../src/sd-cli.ts"],"names":[],"mappings":";AAEA,+BAA+B;AAE/B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,YAAY;AACZ,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEtD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE,CAAC;IACpC,gBAAgB;IAEhB,uBAAuB;IACvB,qCAAqC,CAAC,OAAO,CAAC,GAA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AG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;YACvB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.12.3",
|
|
4
4
|
"description": "심플리즘 패키지 - CLI",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
"bin": "./dist/sd-cli.js",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@angular/build": "^20.0.
|
|
16
|
-
"@angular/compiler": "^20.0.
|
|
17
|
-
"@angular/compiler-cli": "^20.0.
|
|
15
|
+
"@angular/build": "^20.0.3",
|
|
16
|
+
"@angular/compiler": "^20.0.4",
|
|
17
|
+
"@angular/compiler-cli": "^20.0.4",
|
|
18
18
|
"@anthropic-ai/sdk": "^0.54.0",
|
|
19
19
|
"@electron/rebuild": "^4.0.1",
|
|
20
|
-
"@simplysm/sd-core-common": "12.
|
|
21
|
-
"@simplysm/sd-core-node": "12.
|
|
22
|
-
"@simplysm/sd-service-server": "12.
|
|
23
|
-
"@simplysm/sd-storage": "12.
|
|
20
|
+
"@simplysm/sd-core-common": "12.12.3",
|
|
21
|
+
"@simplysm/sd-core-node": "12.12.3",
|
|
22
|
+
"@simplysm/sd-service-server": "12.12.3",
|
|
23
|
+
"@simplysm/sd-storage": "12.12.3",
|
|
24
24
|
"browserslist": "^4.25.0",
|
|
25
25
|
"cordova": "^12.0.0",
|
|
26
26
|
"css-has-pseudo": "^7.0.2",
|
|
27
|
-
"electron": "^36.
|
|
27
|
+
"electron": "^36.5.0",
|
|
28
28
|
"electron-builder": "26.0.12",
|
|
29
29
|
"esbuild": "^0.25.5",
|
|
30
|
-
"eslint": "^9.
|
|
30
|
+
"eslint": "^9.29.0",
|
|
31
31
|
"glob": "^11.0.3",
|
|
32
32
|
"node-stdlib-browser": "^1.3.1",
|
|
33
|
-
"postcss": "^8.5.
|
|
33
|
+
"postcss": "^8.5.6",
|
|
34
34
|
"rxjs": "^7.8.2",
|
|
35
35
|
"sass": "^1.89.2",
|
|
36
36
|
"semver": "^7.7.2",
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"@types/xml2js": "^0.4.14",
|
|
45
45
|
"@types/yargs": "^17.0.33",
|
|
46
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
47
|
-
"vitest": "^3.2.
|
|
47
|
+
"vitest": "^3.2.4"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/sd-cli.ts
CHANGED
|
@@ -14,7 +14,7 @@ if (path.extname(cliPath) === ".ts") {
|
|
|
14
14
|
// .ts 바로실행 (개발)
|
|
15
15
|
|
|
16
16
|
// 현재 프로세스에 affinity 적용
|
|
17
|
-
|
|
17
|
+
configureProcessorAffinityAndPriority(process.pid);
|
|
18
18
|
|
|
19
19
|
await import(cliPath);
|
|
20
20
|
} else {
|
|
@@ -35,6 +35,9 @@ if (path.extname(cliPath) === ".ts") {
|
|
|
35
35
|
[
|
|
36
36
|
"--import=specifier-resolution-node/register",
|
|
37
37
|
"--max-old-space-size=8192",
|
|
38
|
+
"--initial-old-space-size=2048",
|
|
39
|
+
"--max-semi-space-size=128",
|
|
40
|
+
"--stack-size=8192",
|
|
38
41
|
fileURLToPath(cliPath),
|
|
39
42
|
...process.argv.slice(2),
|
|
40
43
|
],
|
|
@@ -44,37 +47,61 @@ if (path.extname(cliPath) === ".ts") {
|
|
|
44
47
|
// 실행된 프로세스에 Affinity 적용
|
|
45
48
|
child.on("spawn", () => {
|
|
46
49
|
if (child.pid == null) return;
|
|
47
|
-
|
|
50
|
+
configureProcessorAffinityAndPriority(child.pid);
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
function
|
|
52
|
-
// 논리 CPU 수 기반 affinity mask 계산 (전체 - 1)
|
|
54
|
+
function configureProcessorAffinityAndPriority(pid: number) {
|
|
53
55
|
const cpuCount = os.cpus().length;
|
|
54
56
|
const affinityMask = calculateAffinityMask(cpuCount);
|
|
55
57
|
|
|
56
|
-
const
|
|
58
|
+
const commands = [
|
|
59
|
+
`$p = Get-Process -Id ${pid}`,
|
|
60
|
+
`$p.ProcessorAffinity = ${affinityMask}`,
|
|
61
|
+
`$p.PriorityClass = 'BelowNormal'`,
|
|
62
|
+
].join("; ");
|
|
63
|
+
|
|
64
|
+
const command = `powershell -Command "${commands}"`;
|
|
57
65
|
|
|
58
66
|
exec(command, (err) => {
|
|
59
67
|
if (err) {
|
|
60
|
-
console.error("Affinity 설정 실패:", err.message);
|
|
68
|
+
console.error("Affinity 또는 우선순위 설정 실패:", err.message);
|
|
61
69
|
}
|
|
62
70
|
});
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
// ProcessorAffinity 마스크 계산
|
|
73
|
+
// ProcessorAffinity 마스크 계산 (앞 코어 빼기)
|
|
66
74
|
function calculateAffinityMask(cpuCount: number): string {
|
|
67
|
-
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount /
|
|
68
|
-
const
|
|
75
|
+
const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 4); // 예: 4개당 1개 제외
|
|
76
|
+
const usableStart = exclude;
|
|
77
|
+
const usableEnd = cpuCount;
|
|
69
78
|
|
|
70
|
-
if (
|
|
79
|
+
if (usableEnd - usableStart <= 0) {
|
|
71
80
|
throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
let mask = 0n;
|
|
84
|
+
|
|
85
|
+
for (let i = usableStart; i < usableEnd; i++) {
|
|
86
|
+
mask |= 1n << BigInt(i);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return "0x" + mask.toString(16).toUpperCase();
|
|
76
90
|
}
|
|
77
91
|
|
|
92
|
+
// ProcessorAffinity 마스크 계산 (뒤 코어 빼기)
|
|
93
|
+
// function calculateAffinityMask(cpuCount: number): string {
|
|
94
|
+
// const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 8); // 8개당 1개씩 뺌
|
|
95
|
+
// const usable = cpuCount - exclude;
|
|
96
|
+
//
|
|
97
|
+
// if (usable <= 0) {
|
|
98
|
+
// throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
99
|
+
// }
|
|
100
|
+
//
|
|
101
|
+
// const maskValue = (1 << usable) - 1;
|
|
102
|
+
// return "0x" + maskValue.toString(16).toUpperCase();
|
|
103
|
+
// }
|
|
104
|
+
|
|
78
105
|
async function spawnWaitAsync(command: string, args: string[]) {
|
|
79
106
|
await new Promise<void>((resolve) => {
|
|
80
107
|
const child = spawn(command, args, {
|