Skip to content

Commit

Permalink
Add CPU logical cores (allegro#3796)
Browse files Browse the repository at this point in the history
  • Loading branch information
awieckowski authored Mar 6, 2024
1 parent fb5f9bf commit eb6d9ca
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ralph/assets/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class Meta:
class ProcessorSimpleSerializer(RalphAPISerializer):
class Meta:
model = Processor
fields = ('id', 'url', 'speed', 'cores')
fields = ('id', 'url', 'speed', 'cores', 'logical_cores')


class ProcessorSerializer(ProcessorSimpleSerializer):
Expand Down
24 changes: 24 additions & 0 deletions src/ralph/assets/migrations/0034_auto_20240304_1511.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('assets', '0033_auto_20211115_1125'),
]

operations = [
migrations.AddField(
model_name='processor',
name='logical_cores',
field=models.PositiveIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='processor',
name='cores',
field=models.PositiveIntegerField(verbose_name='physical cores', blank=True, null=True),
),
]
5 changes: 4 additions & 1 deletion src/ralph/assets/models/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ class Processor(Component):
speed = models.PositiveIntegerField(
verbose_name=_("speed (MHz)"), null=True, blank=True,
)
cores = models.PositiveIntegerField(null=True, blank=True)
cores = models.PositiveIntegerField(
verbose_name="physical cores", null=True, blank=True
)
logical_cores = models.PositiveIntegerField(null=True, blank=True)

class Meta:
verbose_name = _('processor')
Expand Down
1 change: 1 addition & 0 deletions src/ralph/assets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ProcessorInline(RalphTabularInline):
'model_name',
'speed',
'cores',
'logical_cores'
)
extra = 1

Expand Down

0 comments on commit eb6d9ca

Please sign in to comment.