Skip to content

Commit

Permalink
Port FreeBSDMaschine structure cleanup to DragonflyBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed Jan 7, 2025
1 parent 141452e commit 9ce887b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 7 additions & 5 deletions dragonflybsd/DragonFlyBSDMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,20 @@ static void DragonFlyBSDMachine_scanMemoryInfo(Machine* super) {
sysctl(MIB_hw_physmem, 2, &(super->totalMem), &len, NULL, 0);
super->totalMem /= 1024;

sysctl(MIB_vm_stats_vm_v_active_count, 4, &(this->memActive), &len, NULL, 0);
this->memActive *= this->pageSizeKb;
unsigned long long int memActive = 0;
sysctl(MIB_vm_stats_vm_v_active_count, 4, &memActive, &len, NULL, 0);
memActive *= this->pageSizeKb;

sysctl(MIB_vm_stats_vm_v_wire_count, 4, &(this->memWire), &len, NULL, 0);
this->memWire *= this->pageSizeKb;
unsigned long long int memWire = 0;
sysctl(MIB_vm_stats_vm_v_wire_count, 4, &memWire, &len, NULL, 0);
memWire *= this->pageSizeKb;

sysctl(MIB_vfs_bufspace, 2, &(super->buffersMem), &len, NULL, 0);
super->buffersMem /= 1024;

sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(super->cachedMem), &len, NULL, 0);
super->cachedMem *= this->pageSizeKb;
super->usedMem = this->memActive + this->memWire;
super->usedMem = memActive + memWire;

struct kvm_swap swap[16];
int nswap = kvm_getswapinfo(this->kd, swap, ARRAYSIZE(swap), 0);
Expand Down
5 changes: 0 additions & 5 deletions dragonflybsd/DragonFlyBSDMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ typedef struct DragonFlyBSDMachine_ {
int pageSizeKb;
int kernelFScale;

unsigned long long int memWire;
unsigned long long int memActive;
unsigned long long int memInactive;
unsigned long long int memFree;

CPUData* cpus;

unsigned long* cp_time_o;
Expand Down

0 comments on commit 9ce887b

Please sign in to comment.