Current time: 11-15-2024, 02:17 AM Hello There, Guest! (LoginRegister)


Post Reply 
[HOWTO] Show cpu cores in admin system tools
Author Message
qisback Offline
Junior Member
*

Posts: 13
Joined: Jan 2009
Reputation: 0
Post: #1
[HOWTO] Show cpu cores in admin system tools
Currently the system info page only shows

CPU model
CPU MHz
CPU cache
CPU bogomips

This howto will show how to add "Number of CPU cores" to that list.

This is only a quick edit of 2 files

Edit:
/var/www/ispcp/gui/admin/system_info.php

locate
Code:
if (!isset($cpu['cpuspeed'])) {
$cpu['cpuspeed'] = "n.a.";
}

add
Code:
if (!isset($cpu['cpus'])) {
$cpu['cpus'] = "n.a.";
}

locate
Code:
'TR_CPU_MHZ' => tr('CPU MHz'),
'TR_CPU_CACHE' => tr('CPU cache'),
'TR_CPU_BOGOMIPS' => tr('CPU bogomips'),

add
Code:
'TR_CPU_COUNT' => tr('Number of CPU Cores'),

Locate
Code:
'CPU_MODEL' => $cpu['model'],
'CPU_MHZ' => $cpu['cpuspeed'],
'CPU_CACHE' => $cpu['cache'],
'CPU_BOGOMIPS' => $cpu['bogomips'],

add
Code:
'CPU_COUNT' => $cpu['cpus'],

Edit:
/var/www/ispcp/gui/themes/omega_original/system_info.tpl

locate
Code:
<tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content2">{TR_CPU_MODEL}</td>
        <td class="content2">{CPU_MODEL}</td>
</tr>

add above
Code:
<tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content2">{TR_CPU_COUNT}</td>
        <td class="content2">{CPU_COUNT}</td>
</tr>

Tidy the colours up

because you've added a new table row in the table colors will look off i.e. two rows the same colour)

to correct this change the class="content" tags to alternate

i.e.
Code:
<tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content2">{TR_CPU_COUNT}</td>
        <td class="content2">{CPU_COUNT}</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content">{TR_CPU_MODEL}</td>
        <td class="content">{CPU_MODEL}</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content2">{TR_CPU_MHZ}</td>
        <td class="content2">{CPU_MHZ}</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content">{TR_CPU_CACHE}</td>
        <td class="content">{CPU_CACHE}</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td width="200" class="content2">{TR_CPU_BOGOMIPS}</td>
        <td class="content2">{CPU_BOGOMIPS}</td>
      </tr>

Now you should have the following showing
[Image: cpucores.jpg]

Bare in mind you colours will look different as I've created my own colour scheme

I've also attached my edited files.


Attached File(s)
.zip  CPU Cores.zip (Size: 3.97 KB / Downloads: 34)
04-30-2009 12:52 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: [HOWTO] Show cpu cores in admin system tools
Why not ? This is nice Smile
Here is Patch for better testing...

Greez BeNe


Attached File(s)
.patch  cpu_cores.patch (Size: 10.12 KB / Downloads: 33)
04-30-2009 01:09 AM
Visit this user's website Find all posts by this user Quote this message in a reply
qisback Offline
Junior Member
*

Posts: 13
Joined: Jan 2009
Reputation: 0
Post: #3
RE: [HOWTO] Show cpu cores in admin system tools
Cheers for making the patch.

I was considering doing a patch however I'm a great beleavier in "Give a man a fish and he will eat for a day; teach a man to fish and he will eat for a lifetime"

Meaning I tend to show the steps taken and then allow people to follow them rather than just produce a patch and have people ask why it doesn't work with there perticular version.

Although in future if it's the prefered way I'll create patches for any thing I do.
04-30-2009 04:59 AM
Find all posts by this user Quote this message in a reply
Haeber Offline
Junior Member
*****
Dev Team

Posts: 136
Joined: Nov 2007
Reputation: 7
Post: #4
RE: [HOWTO] Show cpu cores in admin system tools
I'll try to add this feature this night into trunk.

Regards
Haeber
I added this feature to trunk, thanks.

Regards
Haeber
(This post was last modified: 04-30-2009 06:31 AM by Haeber.)
04-30-2009 05:36 AM
Find all posts by this user Quote this message in a reply
pgentoo Offline
Member
*****
Dev Team

Posts: 326
Joined: Mar 2007
Reputation: 0
Post: #5
RE: [HOWTO] Show cpu cores in admin system tools
Good call. Haeber, I raised this suggestion a long time ago, and I think I may have had a bug opened on this a long time ago. Might be worth a search...

Thanks,
pgentoo
04-30-2009 12:27 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 3 Guest(s)