Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
monitoring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
monitoring
Commits
13d8bc86
Commit
13d8bc86
authored
2 months ago
by
Thibault Debatty
Browse files
Options
Downloads
Patches
Plain Diff
fix cpu vcores parsing
parent
8028b37c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#19842
failed
2 months ago
Stage: test
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
app/Sensor/ServerInfoFreeBSDCPU.php
+1
-1
1 addition, 1 deletion
app/Sensor/ServerInfoFreeBSDCPU.php
tests/Unit/ServerinfoTest.php
+15
-1
15 additions, 1 deletion
tests/Unit/ServerinfoTest.php
tests/Unit/dmi-cpu
+65
-0
65 additions, 0 deletions
tests/Unit/dmi-cpu
with
83 additions
and
4 deletions
.gitlab-ci.yml
+
2
−
2
View file @
13d8bc86
...
...
@@ -27,7 +27,7 @@ test:php74:
-
cp env.test .env
-
php artisan migrate
script
:
-
vendor/bin/phpunit --coverage-text --colors=never
-
vendor/bin/phpunit --coverage-text --colors=never
--testdox
-
vendor/bin/phpcs
-
vendor/bin/phpstan analyze --memory-limit=512M
-
vendor/bin/unused_scanner unused-scanner.php
...
...
@@ -98,4 +98,4 @@ deploy:
# docker login and restart services
-
ssh monitoring@$SERVER "cd /home/monitoring;
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY;
docker compose up -d --scale queue=4"
\ No newline at end of file
docker compose up -d --scale queue=4"
This diff is collapsed.
Click to expand it.
app/Sensor/ServerInfoFreeBSDCPU.php
+
1
−
1
View file @
13d8bc86
...
...
@@ -24,7 +24,7 @@ class ServerInfoFreeBSDCPU extends ServerInfoParser
preg_match_all
(
$REGEX
,
$string
,
$matches
);
foreach
(
$matches
[
1
]
as
$match
)
{
$count
+=
$match
[
0
]
;
$count
+=
$match
;
}
// if regex does not match, or dmi info is empty...
...
...
This diff is collapsed.
Click to expand it.
tests/Unit/ServerinfoTest.php
+
15
−
1
View file @
13d8bc86
...
...
@@ -34,7 +34,7 @@ class ServerinfoTest extends TestCase
* @group cpu
* @group freebsd-cpu
*/
public
function
testThreadsFree
BSD
()
public
function
testThreadsFree
bsd
()
{
$string
=
file_get_contents
(
__DIR__
.
"/freebsd-dmi-cpu"
);
$sensor
=
new
ServerInfoFreeBSDCPU
();
...
...
@@ -42,4 +42,18 @@ class ServerinfoTest extends TestCase
$sensor
->
analyzeString
(
$string
,
$info
);
$this
->
assertEquals
(
4
,
$info
->
vCores
());
}
/**
* Test CPU cores extraction for a system with multiple processors and many threads
*
* @group cpu
*/
public
function
testThreadsMulti
()
{
$string
=
file_get_contents
(
__DIR__
.
"/dmi-cpu"
);
$sensor
=
new
ServerInfoFreeBSDCPU
();
$info
=
new
ServerInfo
();
$sensor
->
analyzeString
(
$string
,
$info
);
$this
->
assertEquals
(
64
,
$info
->
vCores
());
}
}
This diff is collapsed.
Click to expand it.
tests/Unit/dmi-cpu
0 → 100644
+
65
−
0
View file @
13d8bc86
# dmidecode 3.6
# SMBIOS entry point at 0x75cc4000
Found SMBIOS entry point in EFI, reading table from /dev/mem.
SMBIOS 3.5 present.
Handle 0x004A, DMI type 4, 48 bytes
Processor Information
Socket Designation: U3E1
Type: Central Processor
Family: Other
Manufacturer: Intel(R) Corporation
ID: E0 06 0B 00 FF FB EB BF
Version: Intel(R) N100
Voltage: 1.0 V
External Clock: 100 MHz
Max Speed: 3400 MHz
Current Speed: 2871 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x0047
L2 Cache Handle: 0x0048
L3 Cache Handle: 0x0049
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Part Number: To Be Filled By O.E.M.
Core Count: 16
Core Enabled: 16
Thread Count: 32
Characteristics:
64-bit capable
Multi-Core
Execute Protection
Enhanced Virtualization
Power/Performance Control
Handle 0x004A, DMI type 4, 48 bytes
Processor Information
Socket Designation: U3E1
Type: Central Processor
Family: Other
Manufacturer: Intel(R) Corporation
ID: E0 06 0B 00 FF FB EB BF
Version: Intel(R) N100
Voltage: 1.0 V
External Clock: 100 MHz
Max Speed: 3400 MHz
Current Speed: 2871 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x0047
L2 Cache Handle: 0x0048
L3 Cache Handle: 0x0049
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Part Number: To Be Filled By O.E.M.
Core Count: 16
Core Enabled: 16
Thread Count: 32
Characteristics:
64-bit capable
Multi-Core
Execute Protection
Enhanced Virtualization
Power/Performance Control
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment