Page Menu
Home
Search
Configure Global Search
Log In
Paste
P1501
Linux memory load
Active
Public
Actions
Authored by
Hans Goudey (HooglyBoogly)
on Jul 1 2020, 4:33 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
#ifdef WIN32
if
(
info
[
0
])
{
ofs
+=
BLI_snprintf
(
info
+
ofs
,
len
-
ofs
,
" | "
);
}
MEMORYSTATUSEX
statex
;
statex
.
dwLength
=
sizeof
(
statex
);
GlobalMemoryStatusEx
(
&
statex
);
ofs
+=
BLI_snprintf
(
info
+
ofs
,
len
,
TIP_
(
"RAM: %i%%"
),
statex
.
dwMemoryLoad
);
#else
struct
sysinfo
memInfo
;
if
(
sysinfo
(
&
memInfo
)
==
0
)
{
if
(
info
[
0
])
{
ofs
+=
BLI_snprintf
(
info
+
ofs
,
len
-
ofs
,
" | "
);
}
long
long
total_virtual_ram
=
memInfo
.
totalram
;
total_virtual_ram
+=
memInfo
.
totalswap
;
total_virtual_ram
*=
memInfo
.
mem_unit
;
long
long
virtual_ram_used
=
memInfo
.
totalram
-
memInfo
.
freeram
;
virtual_ram_used
+=
memInfo
.
totalswap
-
memInfo
.
freeswap
;
virtual_ram_used
*=
memInfo
.
mem_unit
;
int
ram_load
=
((
float
)
virtual_ram_used
/
(
float
)
total_virtual_ram
)
*
100.0f
;
ofs
+=
BLI_snprintf
(
info
+
ofs
,
len
,
TIP_
(
"RAM: %d%%"
),
ram_load
);
}
#endif
Event Timeline
Hans Goudey (HooglyBoogly)
created this paste.
Jul 1 2020, 4:33 PM
Hans Goudey (HooglyBoogly)
mentioned this in
D7557: UI: Status Bar Changes
.
Jul 1 2020, 4:40 PM
Log In to Comment