ProcessController: reintroduce the static scaling mode.
There is a very good reason to have this: for low number of cores, the default computation makes stupidly large bars. I had tested my changes with various number of cores (1, 2, 3, 4, 8, 16) in QEMU to make sure it looked correct in all cases. I don't understand why kallisti5 reintroduced broken code. This reverts commitb18298348a
. This reverts commitb1b6769b6f
.
This commit is contained in:
parent
0e061f0903
commit
c2e78713f8
@ -31,11 +31,10 @@ PCWindow::PCWindow()
|
||||
|
||||
system_info info;
|
||||
get_system_info(&info);
|
||||
|
||||
int width = info.cpu_count;
|
||||
if (info.cpu_count <= 4)
|
||||
width *= 4;
|
||||
else if (info.cpu_count <= 16)
|
||||
int width = 4;
|
||||
if (info.cpu_count > 4)
|
||||
width = info.cpu_count;
|
||||
if (info.cpu_count <= 16)
|
||||
width *= 2;
|
||||
|
||||
// For the memory bar
|
||||
|
@ -102,6 +102,23 @@ typedef struct {
|
||||
time_t totalTime;
|
||||
} Tdebug_thead_param;
|
||||
|
||||
// Bar layout depending on number of CPUs
|
||||
// This is used only in case the replicant width is 16
|
||||
|
||||
typedef struct {
|
||||
float cpu_width;
|
||||
float cpu_inter;
|
||||
float mem_width;
|
||||
} layoutT;
|
||||
|
||||
layoutT layout[] = {
|
||||
{ 1, 1, 1 },
|
||||
{ 5, 1, 5 }, // 1
|
||||
{ 3, 1, 4 }, // 2
|
||||
{ 2, 1, 3 },
|
||||
{ 2, 0, 3 }, // 4
|
||||
};
|
||||
|
||||
|
||||
extern "C" _EXPORT BView* instantiate_deskbar_item(float maxWidth,
|
||||
float maxHeight);
|
||||
@ -113,11 +130,10 @@ instantiate_deskbar_item(float maxWidth, float maxHeight)
|
||||
|
||||
system_info info;
|
||||
get_system_info(&info);
|
||||
|
||||
int width = info.cpu_count;
|
||||
if (info.cpu_count <= 4)
|
||||
width *= 4;
|
||||
else if (info.cpu_count <= 16)
|
||||
int width = 4;
|
||||
if (info.cpu_count > 4)
|
||||
width = info.cpu_count;
|
||||
if (info.cpu_count <= 16)
|
||||
width *= 2;
|
||||
|
||||
// For the memory bar
|
||||
@ -592,12 +608,17 @@ ProcessController::DoDraw(bool force)
|
||||
float barWidth;
|
||||
float barGap;
|
||||
float memWidth;
|
||||
|
||||
if (gCPUcount <= 4 && bounds.Width() == 15) {
|
||||
// Use fixed sizes for small CPU counts
|
||||
barWidth = layout[gCPUcount].cpu_width;
|
||||
barGap = layout[gCPUcount].cpu_inter;
|
||||
memWidth = layout[gCPUcount].mem_width;
|
||||
} else {
|
||||
memWidth = floorf((bounds.Height() + 1) / 8);
|
||||
barGap = ((bounds.Width() + 1) / gCPUcount) > 3 ? 1 : 0;
|
||||
barWidth = floorf((bounds.Width() - 1 - memWidth - barGap * gCPUcount)
|
||||
/ gCPUcount);
|
||||
|
||||
}
|
||||
// interspace
|
||||
float right = left + gCPUcount * (barWidth + barGap) - barGap;
|
||||
float leftMem = bounds.Width() - memWidth;
|
||||
|
Loading…
Reference in New Issue
Block a user