apps, kernel: Remove B_MAX_CPU_COUNT
This commit is contained in:
+1
-18
@@ -420,23 +420,6 @@ extern void ktrace_vprintf(const char *format, va_list args);
|
||||
|
||||
/* System information */
|
||||
|
||||
#if __INTEL__
|
||||
# define B_MAX_CPU_COUNT 8
|
||||
#elif __x86_64__
|
||||
# define B_MAX_CPU_COUNT 8
|
||||
#elif __POWERPC__
|
||||
# define B_MAX_CPU_COUNT 8
|
||||
#elif __M68K__
|
||||
# define B_MAX_CPU_COUNT 1
|
||||
#elif __ARM__
|
||||
# define B_MAX_CPU_COUNT 1
|
||||
#elif __MIPSEL__
|
||||
# define B_MAX_CPU_COUNT 1
|
||||
#else
|
||||
# warning Unknown cpu
|
||||
# define B_MAX_CPU_COUNT 1
|
||||
#endif
|
||||
|
||||
typedef enum cpu_types {
|
||||
/* TODO: add latest models */
|
||||
|
||||
@@ -740,7 +723,7 @@ typedef struct {
|
||||
int32 cpu_count; /* number of cpus */
|
||||
enum cpu_types cpu_type; /* type of cpu */
|
||||
int32 cpu_revision; /* revision # of cpu */
|
||||
cpu_info cpu_infos[B_MAX_CPU_COUNT]; /* info about individual cpus */
|
||||
cpu_info cpu_infos[8]; /* info about individual cpus */
|
||||
int64 cpu_clock_speed; /* processor clock speed (Hz) */
|
||||
int64 bus_clock_speed; /* bus clock speed (Hz) */
|
||||
enum platform_types platform_type; /* type of machine we're on */
|
||||
|
||||
@@ -158,7 +158,11 @@ ProcessController::ProcessController(BRect frame, bool temp)
|
||||
fTrackerIcon(kTrackerSig),
|
||||
fDeskbarIcon(kDeskbarSig),
|
||||
fTerminalIcon(kTerminalSig),
|
||||
fTemp(temp)
|
||||
kCPUCount(sysconf(_SC_NPROCESSORS_CONF)),
|
||||
fTemp(temp),
|
||||
fLastBarHeight(new float[kCPUCount]),
|
||||
fCPUTimes(new double[kCPUCount]),
|
||||
fPrevActive(new bigtime_t[kCPUCount])
|
||||
{
|
||||
if (!temp) {
|
||||
Init();
|
||||
@@ -178,7 +182,11 @@ ProcessController::ProcessController(BMessage *data)
|
||||
fTrackerIcon(kTrackerSig),
|
||||
fDeskbarIcon(kDeskbarSig),
|
||||
fTerminalIcon(kTerminalSig),
|
||||
fTemp(false)
|
||||
kCPUCount(sysconf(_SC_NPROCESSORS_CONF)),
|
||||
fTemp(false),
|
||||
fLastBarHeight(new float[kCPUCount]),
|
||||
fCPUTimes(new double[kCPUCount]),
|
||||
fPrevActive(new bigtime_t[kCPUCount])
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -191,7 +199,11 @@ ProcessController::ProcessController()
|
||||
fTrackerIcon(kTrackerSig),
|
||||
fDeskbarIcon(kDeskbarSig),
|
||||
fTerminalIcon(kTerminalSig),
|
||||
fTemp(false)
|
||||
kCPUCount(sysconf(_SC_NPROCESSORS_CONF)),
|
||||
fTemp(false),
|
||||
fLastBarHeight(new float[kCPUCount]),
|
||||
fCPUTimes(new double[kCPUCount]),
|
||||
fPrevActive(new bigtime_t[kCPUCount])
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -208,6 +220,10 @@ ProcessController::~ProcessController()
|
||||
|
||||
delete fMessageRunner;
|
||||
gPCView = NULL;
|
||||
|
||||
delete[] fPrevActive;
|
||||
delete[] fCPUTimes;
|
||||
delete[] fLastBarHeight;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,12 +60,13 @@ class ProcessController : public BView {
|
||||
void Init();
|
||||
void _HandleDebugRequest(team_id team, thread_id thread);
|
||||
|
||||
const int32 kCPUCount;
|
||||
bool fTemp;
|
||||
float fMemoryUsage;
|
||||
float fLastBarHeight[B_MAX_CPU_COUNT];
|
||||
float* fLastBarHeight;
|
||||
float fLastMemoryHeight;
|
||||
double fCPUTimes[B_MAX_CPU_COUNT];
|
||||
bigtime_t fPrevActive[B_MAX_CPU_COUNT];
|
||||
double* fCPUTimes;
|
||||
bigtime_t* fPrevActive;
|
||||
bigtime_t fPrevTime;
|
||||
BMessageRunner* fMessageRunner;
|
||||
rgb_color frame_color, active_color, idle_color, memory_color, swap_color;
|
||||
|
||||
@@ -64,7 +64,7 @@ MiniPulseView::MiniPulseView(BMessage *message)
|
||||
void MiniPulseView::Draw(BRect rect) {
|
||||
system_info sys_info;
|
||||
get_system_info(&sys_info);
|
||||
if (sys_info.cpu_count > B_MAX_CPU_COUNT || sys_info.cpu_count <= 0)
|
||||
if (sys_info.cpu_count <= 0)
|
||||
return;
|
||||
|
||||
BRect bounds(Bounds());
|
||||
|
||||
@@ -26,8 +26,14 @@
|
||||
#define B_TRANSLATION_CONTEXT "PulseView"
|
||||
|
||||
|
||||
PulseView::PulseView(BRect rect, const char *name) :
|
||||
BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS) {
|
||||
PulseView::PulseView(BRect rect, const char *name)
|
||||
:
|
||||
BView(rect, name, B_FOLLOW_ALL_SIDES,
|
||||
B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS),
|
||||
kCPUCount(sysconf(_SC_NPROCESSORS_CONF)),
|
||||
cpu_times(new double[kCPUCount]),
|
||||
prev_active(new bigtime_t[kCPUCount])
|
||||
{
|
||||
|
||||
popupmenu = NULL;
|
||||
cpu_menu_items = NULL;
|
||||
@@ -40,7 +46,13 @@ PulseView::PulseView(BRect rect, const char *name) :
|
||||
}
|
||||
|
||||
// This version will be used by the instantiated replicant
|
||||
PulseView::PulseView(BMessage *message) : BView(message) {
|
||||
PulseView::PulseView(BMessage *message)
|
||||
:
|
||||
BView(message),
|
||||
kCPUCount(sysconf(_SC_NPROCESSORS_CONF)),
|
||||
cpu_times(new double[kCPUCount]),
|
||||
prev_active(new bigtime_t[kCPUCount])
|
||||
{
|
||||
SetResizingMode(B_FOLLOW_ALL_SIDES);
|
||||
SetFlags(B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
|
||||
@@ -138,5 +150,8 @@ void PulseView::ChangeCPUState(BMessage *message) {
|
||||
PulseView::~PulseView() {
|
||||
if (popupmenu != NULL) delete popupmenu;
|
||||
if (cpu_menu_items != NULL) delete cpu_menu_items;
|
||||
|
||||
delete[] prev_active;
|
||||
delete[] cpu_times;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ class PulseView : public BView {
|
||||
BMenuItem *mode1, *mode2, *preferences, *about;
|
||||
BMenuItem **cpu_menu_items;
|
||||
|
||||
double cpu_times[B_MAX_CPU_COUNT];
|
||||
bigtime_t prev_active[B_MAX_CPU_COUNT];
|
||||
const int32 kCPUCount;
|
||||
|
||||
double* cpu_times;
|
||||
bigtime_t* prev_active;
|
||||
bigtime_t prev_time;
|
||||
};
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ x86_smp_error_interrupt(void *data)
|
||||
uint32
|
||||
x86_get_cpu_apic_id(int32 cpu)
|
||||
{
|
||||
ASSERT(cpu >= 0 && cpu < B_MAX_CPU_COUNT);
|
||||
ASSERT(cpu >= 0 && cpu < SMP_MAX_CPUS);
|
||||
return sCPUAPICIds[cpu];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user