Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
5ba46d4b
Commit
5ba46d4b
authored
Apr 01, 2026
by
Andrew Imm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Continue adding tracing metadata, with system memory
parent
a230e9a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
+72
-0
Cargo.lock
Cargo.lock
+1
-0
Cargo.toml
Cargo.toml
+1
-0
Cargo.toml
crates/next-api/Cargo.toml
+1
-0
project.rs
crates/next-api/src/project.rs
+69
-0
No files found.
Cargo.lock
View file @
5ba46d4b
...
@@ -4425,6 +4425,7 @@ dependencies = [
...
@@ -4425,6 +4425,7 @@ dependencies = [
"either",
"either",
"futures",
"futures",
"indexmap 2.13.0",
"indexmap 2.13.0",
"libc",
"next-core",
"next-core",
"regex",
"regex",
"roaring",
"roaring",
...
...
Cargo.toml
View file @
5ba46d4b
...
@@ -274,6 +274,7 @@ indexmap = "2.13.0"
...
@@ -274,6 +274,7 @@ indexmap = "2.13.0"
indoc
=
"2.0.0"
indoc
=
"2.0.0"
inventory
=
"0.3.21"
inventory
=
"0.3.21"
itertools
=
"0.10.5"
itertools
=
"0.10.5"
libc
=
"0.2.174"
lightningcss
=
{
version
=
"1.0.0-alpha.70"
,
features
=
[
lightningcss
=
{
version
=
"1.0.0-alpha.70"
,
features
=
[
"serde"
,
"serde"
,
"visitor"
,
"visitor"
,
...
...
crates/next-api/Cargo.toml
View file @
5ba46d4b
...
@@ -24,6 +24,7 @@ byteorder = { workspace = true }
...
@@ -24,6 +24,7 @@ byteorder = { workspace = true }
either
=
{
workspace
=
true
}
either
=
{
workspace
=
true
}
futures
=
{
workspace
=
true
}
futures
=
{
workspace
=
true
}
indexmap
=
{
workspace
=
true
}
indexmap
=
{
workspace
=
true
}
libc
=
{
workspace
=
true
}
next-core
=
{
workspace
=
true
}
next-core
=
{
workspace
=
true
}
regex
=
{
workspace
=
true
}
regex
=
{
workspace
=
true
}
roaring
=
{
workspace
=
true
}
roaring
=
{
workspace
=
true
}
...
...
crates/next-api/src/project.rs
View file @
5ba46d4b
use
std
::
time
::
Duration
;
use
std
::
time
::
Duration
;
/// Returns total physical memory in bytes, or 0 if it cannot be determined.
fn
total_memory_bytes
()
->
u64
{
#[cfg(target_os
=
"macos"
)]
{
let
mut
mib
=
[
libc
::
CTL_HW
,
libc
::
HW_MEMSIZE
];
let
mut
total
:
u64
=
0
;
let
mut
len
=
std
::
mem
::
size_of
::
<
u64
>
();
// SAFETY: sysctl with CTL_HW/HW_MEMSIZE writes a u64 into `total`.
unsafe
{
libc
::
sysctl
(
mib
.as_mut_ptr
(),
2
,
&
mut
total
as
*
mut
u64
as
*
mut
libc
::
c_void
,
&
mut
len
,
std
::
ptr
::
null_mut
(),
0
,
);
}
total
}
#[cfg(target_os
=
"linux"
)]
{
// Parse MemTotal from /proc/meminfo (value is in kB).
std
::
fs
::
read_to_string
(
"/proc/meminfo"
)
.ok
()
.and_then
(|
content
|
{
content
.lines
()
.find_map
(|
line
|
{
let
rest
=
line
.strip_prefix
(
"MemTotal:"
)
?
;
let
kb
:
u64
=
rest
.trim
()
.strip_suffix
(
"kB"
)
?
.trim
()
.parse
()
.ok
()
?
;
Some
(
kb
*
1024
)
})
})
.unwrap_or
(
0
)
}
#[cfg(target_os
=
"windows"
)]
{
#[repr(C)]
struct
MemoryStatusEx
{
dw_length
:
u32
,
dw_memory_load
:
u32
,
ull_total_phys
:
u64
,
ull_avail_phys
:
u64
,
ull_total_page_file
:
u64
,
ull_avail_page_file
:
u64
,
ull_total_virtual
:
u64
,
ull_avail_virtual
:
u64
,
ull_avail_extended_virtual
:
u64
,
}
unsafe
extern
"system"
{
fn
GlobalMemoryStatusEx
(
lp_buffer
:
*
mut
MemoryStatusEx
)
->
i32
;
}
// SAFETY: GlobalMemoryStatusEx fills the struct when dw_length is set correctly.
unsafe
{
let
mut
info
:
MemoryStatusEx
=
std
::
mem
::
zeroed
();
info
.dw_length
=
std
::
mem
::
size_of
::
<
MemoryStatusEx
>
()
as
u32
;
GlobalMemoryStatusEx
(
&
mut
info
);
info
.ull_total_phys
}
}
#[cfg(not(any(target_os
=
"macos"
,
target_os
=
"linux"
,
target_os
=
"windows"
)))]
{
0
}
}
use
anyhow
::{
Context
,
Result
,
bail
};
use
anyhow
::{
Context
,
Result
,
bail
};
use
bincode
::{
Decode
,
Encode
};
use
bincode
::{
Decode
,
Encode
};
use
indexmap
::
map
::
Entry
;
use
indexmap
::
map
::
Entry
;
...
@@ -592,6 +660,7 @@ impl ProjectContainer {
...
@@ -592,6 +660,7 @@ impl ProjectContainer {
cpu_cores
=
std
::
thread
::
available_parallelism
()
cpu_cores
=
std
::
thread
::
available_parallelism
()
.map
(|
n
|
n
.get
())
.map
(|
n
|
n
.get
())
.unwrap_or
(
0
),
.unwrap_or
(
0
),
system_memory_mb
=
(
total_memory_bytes
()
/
(
1024
*
1024
))
as
u32
,
dev
=
options
.dev
,
dev
=
options
.dev
,
env_diff
=
Empty
env_diff
=
Empty
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment