Skip to content

Commit 829e053

Browse files
shuaijiedeepin-bot[bot]
authored andcommitted
feat: 显示cpu的L4缓存信息
D3000适配L4 Log: New cpu D3000适配 Task: https://pms.uniontech.com/task-view-358933.html
1 parent f03ef3c commit 829e053

7 files changed

Lines changed: 38 additions & 0 deletions

File tree

deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/cpu/corecpu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void CoreCpu::getInfo(QString &info)
6262
appendKeyValue(info, "L1i cache", logical.l1iCache());
6363
appendKeyValue(info, "L2 cache", logical.l2Cache());
6464
appendKeyValue(info, "L3 cache", logical.l3Cache());
65+
appendKeyValue(info, "L4 cache", logical.l4Cache());
6566
appendKeyValue(info, "CPU MHz", logical.curFreq());
6667
appendKeyValue(info, "CPU max MHz", logical.maxFreq());
6768
appendKeyValue(info, "CPU min MHz", logical.minFreq());

deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/cpu/cpuinfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ void CpuInfo::readCpuCacheIndex(const QString &path, LogicalCpu &lcpu)
368368
lcpu.setL2Cache(value);
369369
} else if (level == 3) {
370370
lcpu.setL3Cache(value);
371+
} else if (level == 4) {
372+
lcpu.setL4Cache(value);
371373
} else if (level == 1) {
372374
if (type.contains("Data", Qt::CaseInsensitive))
373375
lcpu.setL1dCache(value);

deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/cpu/logicalcpu.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ void LogicalCpu::setL3Cache(const QString &value)
4949
Q_D(LogicalCpu);
5050
d->l3_cache = value;
5151
}
52+
void LogicalCpu::setL4Cache(const QString &value)
53+
{
54+
Q_D(LogicalCpu);
55+
d->l4_cache = value;
56+
}
5257
void LogicalCpu::setMinFreq(const QString &value)
5358
{
5459
Q_D(LogicalCpu);
@@ -141,6 +146,11 @@ const QString &LogicalCpu::l3Cache()
141146
Q_D(LogicalCpu);
142147
return d->l3_cache;
143148
}
149+
const QString &LogicalCpu::l4Cache()
150+
{
151+
Q_D(LogicalCpu);
152+
return d->l4_cache;
153+
}
144154
const QString &LogicalCpu::minFreq()
145155
{
146156
Q_D(LogicalCpu);
@@ -208,6 +218,7 @@ void LogicalCpu::diagPrintInfo()
208218
qCInfo(appLog) << "l1i_cache : " << d->l1i_cache;
209219
qCInfo(appLog) << "l2_cache : " << d->l2_cache;
210220
qCInfo(appLog) << "l3_cache : " << d->l3_cache;
221+
qCInfo(appLog) << "l4_cache : " << d->l4_cache;
211222
qCInfo(appLog) << "max_freq : " << d->max_freq;
212223
qCInfo(appLog) << "min_freq : " << d->min_freq;
213224
qCInfo(appLog) << "cur_freq : " << d->cur_freq;

deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/cpu/logicalcpu.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class LogicalCpu
5555
*/
5656
void setL3Cache(const QString &value);
5757

58+
/**
59+
* @brief setL4Cache : set l4 cache
60+
* @param value cache
61+
*/
62+
void setL4Cache(const QString &value);
63+
5864
/**
5965
* @brief setMinFreq : set min freq
6066
* @param value : freq
@@ -168,6 +174,12 @@ class LogicalCpu
168174
*/
169175
const QString &l3Cache();
170176

177+
/**
178+
* @brief l4Cache
179+
* @return : value
180+
*/
181+
const QString &l4Cache();
182+
171183
/**
172184
* @brief minFreq
173185
* @return : value
@@ -253,6 +265,7 @@ class LogicalCpuPrivate
253265
, l1i_cache("")
254266
, l2_cache("")
255267
, l3_cache("")
268+
, l4_cache("")
256269
, max_freq("")
257270
, min_freq("")
258271
, cur_freq("")
@@ -275,6 +288,7 @@ class LogicalCpuPrivate
275288
QString l1i_cache; // l1i cache
276289
QString l2_cache; // l2 cache
277290
QString l3_cache; // l3 cache
291+
QString l4_cache; // l4 cache
278292
QString max_freq; // max freq
279293
QString min_freq; // min freq
280294
QString cur_freq; // cur freq

deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DeviceCpu::DeviceCpu()
2323
, m_CacheL1Order("")
2424
, m_CacheL2("")
2525
, m_CacheL3("")
26+
, m_CacheL4("")
2627
, m_Extensions("")
2728
, m_Flags("")
2829
, m_HardwareVirtual("")
@@ -137,6 +138,7 @@ void DeviceCpu::setInfoFromLscpu(const QMap<QString, QString> &mapInfo)
137138
setAttribute(mapInfo, "L1i cache", m_CacheL1Order);
138139
setAttribute(mapInfo, "L2 cache", m_CacheL2);
139140
setAttribute(mapInfo, "L3 cache", m_CacheL3);
141+
setAttribute(mapInfo, "L4 cache", m_CacheL4);
140142
setAttribute(mapInfo, "flags", m_Flags);
141143
setAttribute(mapInfo, "Virtualization", m_HardwareVirtual);
142144

@@ -228,6 +230,7 @@ TomlFixMethod DeviceCpu::setInfoFromTomlOneByOne(const QMap<QString, QString> &m
228230
ret = setTomlAttribute(mapInfo, "Virtualization", m_HardwareVirtual);
229231
ret = setTomlAttribute(mapInfo, "Flags", m_Flags);
230232
ret = setTomlAttribute(mapInfo, "Extensions", m_Extensions);
233+
ret = setTomlAttribute(mapInfo, "L4 Cache", m_CacheL4);
231234
ret = setTomlAttribute(mapInfo, "L3 Cache", m_CacheL3);
232235
ret = setTomlAttribute(mapInfo, "L2 Cache", m_CacheL2);
233236
ret = setTomlAttribute(mapInfo, "L1i Cache", m_CacheL1Order);
@@ -272,6 +275,7 @@ void DeviceCpu::loadOtherDeviceInfo()
272275
addOtherDeviceInfo(tr("L1i Cache"), m_CacheL1Order);
273276
addOtherDeviceInfo(tr("L1d Cache"), m_CacheL1Data);
274277
addOtherDeviceInfo(tr("Stepping"), m_Step);
278+
addOtherDeviceInfo(tr("L4 Cache"), m_CacheL4);
275279

276280
// 将QMap<QString, QString>内容转存为QList<QPair<QString, QString>>
277281
mapInfoToList();

deepin-devicemanager/src/DeviceManager/DeviceCpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class DeviceCpu : public DeviceBaseInfo
159159
QString m_CacheL1Order; //<! L1缓存(指令)
160160
QString m_CacheL2; //<! L2缓存
161161
QString m_CacheL3; //<! L3缓存
162+
QString m_CacheL4; //<! L4缓存
162163
QString m_Extensions; //<! 扩展指令集
163164
QString m_Flags; //<! 特性
164165
QString m_HardwareVirtual; //<! 硬件虚拟化

deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@
447447
<source>L3 Cache</source>
448448
<translation>L3缓存</translation>
449449
</message>
450+
<message>
451+
<location filename="../src/DeviceManager/DeviceCpu.cpp" line="275"/>
452+
<source>L4 Cache</source>
453+
<translation>L4缓存</translation>
454+
</message>
450455
<message>
451456
<location filename="../src/DeviceManager/DeviceCpu.cpp" line="271"/>
452457
<source>L2 Cache</source>

0 commit comments

Comments
 (0)