Fixed tracing printf formats in VM code.

This commit is contained in:
Alex Smith
2012-07-05 20:17:31 +01:00
parent 1671cfdf2c
commit 11d35d1b9b
6 changed files with 62 additions and 53 deletions
+3 -2
View File
@@ -195,8 +195,9 @@ VMAddressSpace::Create(team_id teamID, addr_t base, size_t size, bool kernel,
return status; return status;
} }
TRACE(("VMAddressSpace::Create(): team %ld (%skernel): %#lx bytes starting at " TRACE(("VMAddressSpace::Create(): team %" B_PRId32 " (%skernel): %#lx "
"%#lx => %p\n", teamID, kernel ? "" : "!", size, base, addressSpace)); "bytes starting at %#lx => %p\n", teamID, kernel ? "" : "!", size,
base, addressSpace));
// create the corresponding translation map // create the corresponding translation map
status = arch_vm_translation_map_create_map(kernel, status = arch_vm_translation_map_create_map(kernel,
+9 -7
View File
@@ -448,8 +448,9 @@ VMAnonymousCache::Init(bool canOvercommit, int32 numPrecommittedPages,
int32 numGuardPages, uint32 allocationFlags) int32 numGuardPages, uint32 allocationFlags)
{ {
TRACE("%p->VMAnonymousCache::Init(canOvercommit = %s, " TRACE("%p->VMAnonymousCache::Init(canOvercommit = %s, "
"numPrecommittedPages = %ld, numGuardPages = %ld)\n", this, "numPrecommittedPages = %" B_PRId32 ", numGuardPages = %" B_PRId32
canOvercommit ? "yes" : "no", numPrecommittedPages, numGuardPages); ")\n", this, canOvercommit ? "yes" : "no", numPrecommittedPages,
numGuardPages);
status_t error = VMCache::Init(CACHE_TYPE_RAM, allocationFlags); status_t error = VMCache::Init(CACHE_TYPE_RAM, allocationFlags);
if (error != B_OK) if (error != B_OK)
@@ -528,7 +529,7 @@ VMAnonymousCache::Resize(off_t newSize, int priority)
status_t status_t
VMAnonymousCache::Commit(off_t size, int priority) VMAnonymousCache::Commit(off_t size, int priority)
{ {
TRACE("%p->VMAnonymousCache::Commit(%lld)\n", this, size); TRACE("%p->VMAnonymousCache::Commit(%" B_PRIdOFF ")\n", this, size);
// If we can overcommit, we don't commit here, but in Fault(). We always // If we can overcommit, we don't commit here, but in Fault(). We always
// unreserve memory, if we're asked to shrink our commitment, though. // unreserve memory, if we're asked to shrink our commitment, though.
@@ -950,8 +951,9 @@ VMAnonymousCache::_SwapBlockGetAddress(off_t pageIndex)
status_t status_t
VMAnonymousCache::_Commit(off_t size, int priority) VMAnonymousCache::_Commit(off_t size, int priority)
{ {
TRACE("%p->VMAnonymousCache::_Commit(%lld), already committed: %lld " TRACE("%p->VMAnonymousCache::_Commit(%" B_PRIdOFF "), already committed: "
"(%lld swap)\n", this, size, committed_size, fCommittedSwapSize); "%" B_PRIdOFF " (%" B_PRIdOFF " swap)\n", this, size, committed_size,
fCommittedSwapSize);
// Basic strategy: reserve swap space first, only when running out of swap // Basic strategy: reserve swap space first, only when running out of swap
// space, reserve real memory. // space, reserve real memory.
@@ -965,8 +967,8 @@ VMAnonymousCache::_Commit(off_t size, int priority)
fCommittedSwapSize += swap_space_reserve(size - fCommittedSwapSize); fCommittedSwapSize += swap_space_reserve(size - fCommittedSwapSize);
committed_size = fCommittedSwapSize + committedMemory; committed_size = fCommittedSwapSize + committedMemory;
if (size > fCommittedSwapSize) { if (size > fCommittedSwapSize) {
TRACE("%p->VMAnonymousCache::_Commit(%lld), reserved only %lld " TRACE("%p->VMAnonymousCache::_Commit(%" B_PRIdOFF "), reserved "
"swap\n", this, size, fCommittedSwapSize); "only %" B_PRIdOFF " swap\n", this, size, fCommittedSwapSize);
} }
} }
+8 -8
View File
@@ -679,7 +679,7 @@ VMCache::Delete()
page->SetCacheRef(NULL); page->SetCacheRef(NULL);
TRACE(("vm_cache_release_ref: freeing page 0x%lx\n", TRACE(("vm_cache_release_ref: freeing page 0x%lx\n",
oldPage->physical_page_number)); page->physical_page_number));
DEBUG_PAGE_ACCESS_START(page); DEBUG_PAGE_ACCESS_START(page);
vm_page_free(this, page); vm_page_free(this, page);
} }
@@ -769,7 +769,7 @@ VMCache::LookupPage(off_t offset)
void void
VMCache::InsertPage(vm_page* page, off_t offset) VMCache::InsertPage(vm_page* page, off_t offset)
{ {
TRACE(("VMCache::InsertPage(): cache %p, page %p, offset %Ld\n", TRACE(("VMCache::InsertPage(): cache %p, page %p, offset %" B_PRIdOFF "\n",
this, page, offset)); this, page, offset));
AssertLocked(); AssertLocked();
@@ -928,7 +928,7 @@ VMCache::WaitForPageEvents(vm_page* page, uint32 events, bool relock)
void void
VMCache::AddConsumer(VMCache* consumer) VMCache::AddConsumer(VMCache* consumer)
{ {
TRACE(("add consumer vm cache %p to cache %p\n", consumer, cache)); TRACE(("add consumer vm cache %p to cache %p\n", consumer, this));
AssertLocked(); AssertLocked();
consumer->AssertLocked(); consumer->AssertLocked();
@@ -1054,8 +1054,8 @@ VMCache::WriteModified()
status_t status_t
VMCache::SetMinimalCommitment(off_t commitment, int priority) VMCache::SetMinimalCommitment(off_t commitment, int priority)
{ {
TRACE(("VMCache::SetMinimalCommitment(cache %p, commitment %Ld)\n", TRACE(("VMCache::SetMinimalCommitment(cache %p, commitment %" B_PRIdOFF
this, commitment)); ")\n", this, commitment));
AssertLocked(); AssertLocked();
T(SetMinimalCommitment(this, commitment)); T(SetMinimalCommitment(this, commitment));
@@ -1088,8 +1088,8 @@ VMCache::SetMinimalCommitment(off_t commitment, int priority)
status_t status_t
VMCache::Resize(off_t newSize, int priority) VMCache::Resize(off_t newSize, int priority)
{ {
TRACE(("VMCache::Resize(cache %p, newSize %Ld) old size %Ld\n", TRACE(("VMCache::Resize(cache %p, newSize %" B_PRIdOFF ") old size %"
this, newSize, this->virtual_end)); B_PRIdOFF "\n", this, newSize, this->virtual_end));
this->AssertLocked(); this->AssertLocked();
T(Resize(this, newSize)); T(Resize(this, newSize));
@@ -1400,7 +1400,7 @@ VMCache::_MergeWithOnlyConsumer()
{ {
VMCache* consumer = consumers.RemoveHead(); VMCache* consumer = consumers.RemoveHead();
TRACE(("merge vm cache %p (ref == %ld) with vm cache %p\n", TRACE(("merge vm cache %p (ref == %" B_PRId32 ") with vm cache %p\n",
this, this->fRefCount, consumer)); this, this->fRefCount, consumer));
T(Merge(this, consumer)); T(Merge(this, consumer));
@@ -151,7 +151,7 @@ VMKernelAddressSpace::CreateArea(const char* name, uint32 wiring,
void void
VMKernelAddressSpace::DeleteArea(VMArea* _area, uint32 allocationFlags) VMKernelAddressSpace::DeleteArea(VMArea* _area, uint32 allocationFlags)
{ {
TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", area); TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", _area);
VMKernelArea* area = static_cast<VMKernelArea*>(_area); VMKernelArea* area = static_cast<VMKernelArea*>(_area);
object_cache_delete(fAreaObjectCache, area); object_cache_delete(fAreaObjectCache, area);
+28 -24
View File
@@ -60,7 +60,7 @@
//#define TRACE_VM //#define TRACE_VM
//#define TRACE_FAULTS #define TRACE_FAULTS
#ifdef TRACE_VM #ifdef TRACE_VM
# define TRACE(x) dprintf x # define TRACE(x) dprintf x
#else #else
@@ -784,10 +784,11 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,
uint32 flags, const virtual_address_restrictions* addressRestrictions, uint32 flags, const virtual_address_restrictions* addressRestrictions,
bool kernel, VMArea** _area, void** _virtualAddress) bool kernel, VMArea** _area, void** _virtualAddress)
{ {
TRACE(("map_backing_store: aspace %p, cache %p, virtual %p, offset 0x%Lx, " TRACE(("map_backing_store: aspace %p, cache %p, virtual %p, offset 0x%"
"size %lu, addressSpec %ld, wiring %d, protection %d, area %p, areaName " B_PRIx64 ", size %" B_PRIuADDR ", addressSpec %" B_PRIu32 ", wiring %d"
"'%s'\n", addressSpace, cache, addressRestrictions->address, offset, ", protection %d, area %p, areaName '%s'\n", addressSpace, cache,
size, addressRestrictions->address_specification, wiring, protection, addressRestrictions->address, offset, size,
addressRestrictions->address_specification, wiring, protection,
_area, areaName)); _area, areaName));
cache->AssertLocked(); cache->AssertLocked();
@@ -1191,7 +1192,8 @@ vm_create_anonymous_area(team_id team, const char *name, addr_t size,
uint32 pageAllocFlags = (flags & CREATE_AREA_DONT_CLEAR) == 0 uint32 pageAllocFlags = (flags & CREATE_AREA_DONT_CLEAR) == 0
? VM_PAGE_ALLOC_CLEAR : 0; ? VM_PAGE_ALLOC_CLEAR : 0;
TRACE(("create_anonymous_area [%ld] %s: size 0x%lx\n", team, name, size)); TRACE(("create_anonymous_area [%" B_PRId32 "] %s: size 0x%" B_PRIxADDR "\n",
team, name, size));
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
@@ -1557,10 +1559,10 @@ vm_map_physical_memory(team_id team, const char* name, void** _address,
VMCache* cache; VMCache* cache;
addr_t mapOffset; addr_t mapOffset;
TRACE(("vm_map_physical_memory(aspace = %ld, \"%s\", virtual = %p, " TRACE(("vm_map_physical_memory(aspace = %" B_PRId32 ", \"%s\", virtual = %p"
"spec = %ld, size = %lu, protection = %ld, phys = %#" B_PRIxPHYSADDR ", spec = %" B_PRIu32 ", size = %" B_PRIxADDR ", protection = %"
")\n", team, name, *_address, addressSpec, size, protection, B_PRIu32 ", phys = %#" B_PRIxPHYSADDR ")\n", team, name, *_address,
physicalAddress)); addressSpec, size, protection, physicalAddress));
if (!arch_vm_supports_protection(protection)) if (!arch_vm_supports_protection(protection))
return B_NOT_SUPPORTED; return B_NOT_SUPPORTED;
@@ -1664,10 +1666,10 @@ vm_map_physical_memory_vecs(team_id team, const char* name, void** _address,
uint32 addressSpec, addr_t* _size, uint32 protection, uint32 addressSpec, addr_t* _size, uint32 protection,
struct generic_io_vec* vecs, uint32 vecCount) struct generic_io_vec* vecs, uint32 vecCount)
{ {
TRACE(("vm_map_physical_memory_vecs(team = %ld, \"%s\", virtual = %p, " TRACE(("vm_map_physical_memory_vecs(team = %" B_PRId32 ", \"%s\", virtual "
"spec = %ld, _size = %p, protection = %ld, vecs = %p, " "= %p, spec = %" B_PRIu32 ", _size = %p, protection = %" B_PRIu32 ", "
"vecCount = %ld)\n", team, name, *_address, addressSpec, _size, "vecs = %p, vecCount = %" B_PRIu32 ")\n", team, name, *_address,
protection, vecs, vecCount)); addressSpec, _size, protection, vecs, vecCount));
if (!arch_vm_supports_protection(protection) if (!arch_vm_supports_protection(protection)
|| (addressSpec & B_MTR_MASK) != 0) { || (addressSpec & B_MTR_MASK) != 0) {
@@ -1859,8 +1861,8 @@ _vm_map_file(team_id team, const char* name, void** _address,
// copy of a file at a given time, ie. later changes should not // copy of a file at a given time, ie. later changes should not
// make it into the mapped copy -- this will need quite some changes // make it into the mapped copy -- this will need quite some changes
// to be done in a nice way // to be done in a nice way
TRACE(("_vm_map_file(fd = %d, offset = %Ld, size = %lu, mapping %ld)\n", TRACE(("_vm_map_file(fd = %d, offset = %" B_PRIdOFF ", size = %lu, mapping "
fd, offset, size, mapping)); "%" B_PRIu32 ")\n", fd, offset, size, mapping));
offset = ROUNDDOWN(offset, B_PAGE_SIZE); offset = ROUNDDOWN(offset, B_PAGE_SIZE);
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
@@ -2249,7 +2251,8 @@ delete_area(VMAddressSpace* addressSpace, VMArea* area,
status_t status_t
vm_delete_area(team_id team, area_id id, bool kernel) vm_delete_area(team_id team, area_id id, bool kernel)
{ {
TRACE(("vm_delete_area(team = 0x%lx, area = 0x%lx)\n", team, id)); TRACE(("vm_delete_area(team = 0x%" B_PRIx32 ", area = 0x%" B_PRIx32 ")\n",
team, id));
// lock the address space and make sure the area isn't wired // lock the address space and make sure the area isn't wired
AddressSpaceWriteLocker locker; AddressSpaceWriteLocker locker;
@@ -2520,8 +2523,8 @@ static status_t
vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection, vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection,
bool kernel) bool kernel)
{ {
TRACE(("vm_set_area_protection(team = %#lx, area = %#lx, protection = " TRACE(("vm_set_area_protection(team = %#" B_PRIx32 ", area = %#" B_PRIx32
"%#lx)\n", team, areaID, newProtection)); ", protection = %#" B_PRIx32 ")\n", team, areaID, newProtection));
if (!arch_vm_supports_protection(newProtection)) if (!arch_vm_supports_protection(newProtection))
return B_NOT_SUPPORTED; return B_NOT_SUPPORTED;
@@ -3405,7 +3408,7 @@ dump_available_memory(int argc, char** argv)
void void
vm_delete_areas(struct VMAddressSpace* addressSpace, bool deletingAddressSpace) vm_delete_areas(struct VMAddressSpace* addressSpace, bool deletingAddressSpace)
{ {
TRACE(("vm_delete_areas: called on address space 0x%lx\n", TRACE(("vm_delete_areas: called on address space 0x%" B_PRIx32 "\n",
addressSpace->ID())); addressSpace->ID()));
addressSpace->WriteLock(); addressSpace->WriteLock();
@@ -4365,8 +4368,9 @@ static status_t
vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress, vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
bool isWrite, bool isUser, vm_page** wirePage, VMAreaWiredRange* wiredRange) bool isWrite, bool isUser, vm_page** wirePage, VMAreaWiredRange* wiredRange)
{ {
FTRACE(("vm_soft_fault: thid 0x%lx address 0x%lx, isWrite %d, isUser %d\n", FTRACE(("vm_soft_fault: thid 0x%" B_PRIx32 " address 0x%" B_PRIxADDR ", "
thread_get_current_thread_id(), originalAddress, isWrite, isUser)); "isWrite %d, isUser %d\n", thread_get_current_thread_id(),
originalAddress, isWrite, isUser));
PageFaultContext context(addressSpace, isWrite); PageFaultContext context(addressSpace, isWrite);
@@ -5609,8 +5613,8 @@ get_memory_map_etc(team_id team, const void* address, size_t numBytes,
addr_t offset = 0; addr_t offset = 0;
bool interrupts = are_interrupts_enabled(); bool interrupts = are_interrupts_enabled();
TRACE(("get_memory_map_etc(%ld, %p, %lu bytes, %ld entries)\n", team, TRACE(("get_memory_map_etc(%" B_PRId32 ", %p, %lu bytes, %" B_PRIu32 " "
address, numBytes, numEntries)); "entries)\n", team, address, numBytes, numEntries));
if (numEntries == 0 || numBytes == 0) if (numEntries == 0 || numBytes == 0)
return B_BAD_VALUE; return B_BAD_VALUE;
+13 -11
View File
@@ -2449,8 +2449,8 @@ page_writer(void* /*unused*/)
writtenPages += numPages; writtenPages += numPages;
if (writtenPages >= 1024) { if (writtenPages >= 1024) {
bigtime_t now = system_time(); bigtime_t now = system_time();
TRACE(("page writer: wrote 1024 pages (total: %llu ms, " TRACE(("page writer: wrote 1024 pages (total: %" B_PRIu64 " ms, "
"collect: %llu ms, write: %llu ms)\n", "collect: %" B_PRIu64 " ms, write: %" B_PRIu64 " ms)\n",
(now - lastWrittenTime) / 1000, (now - lastWrittenTime) / 1000,
pageCollectionTime / 1000, pageWritingTime / 1000)); pageCollectionTime / 1000, pageWritingTime / 1000));
lastWrittenTime = now; lastWrittenTime = now;
@@ -2808,9 +2808,10 @@ full_scan_inactive_pages(page_stats& pageStats, int32 despairLevel)
queueLocker.Unlock(); queueLocker.Unlock();
time = system_time() - time; time = system_time() - time;
TRACE_DAEMON(" -> inactive scan (%7lld us): scanned: %7lu, " TRACE_DAEMON(" -> inactive scan (%7" B_PRId64 " us): scanned: %7" B_PRIu32
"moved: %lu -> cached, %lu -> modified, %lu -> active\n", time, ", moved: %" B_PRIu32 " -> cached, %" B_PRIu32 " -> modified, %"
pagesScanned, pagesToCached, pagesToModified, pagesToActive); B_PRIu32 " -> active\n", time, pagesScanned, pagesToCached,
pagesToModified, pagesToActive);
// wake up the page writer, if we tossed it some pages // wake up the page writer, if we tossed it some pages
if (pagesToModified > 0) if (pagesToModified > 0)
@@ -2904,9 +2905,9 @@ full_scan_active_pages(page_stats& pageStats, int32 despairLevel)
} }
time = system_time() - time; time = system_time() - time;
TRACE_DAEMON(" -> active scan (%7lld us): scanned: %7lu, " TRACE_DAEMON(" -> active scan (%7" B_PRId64 " us): scanned: %7" B_PRIu32
"moved: %lu -> inactive, encountered %lu accessed ones\n", time, ", moved: %" B_PRIu32 " -> inactive, encountered %" B_PRIu32 " accessed"
pagesScanned, pagesToInactive, pagesAccessed); " ones\n", time, pagesScanned, pagesToInactive, pagesAccessed);
} }
@@ -2934,9 +2935,10 @@ page_daemon_idle_scan(page_stats& pageStats)
static void static void
page_daemon_full_scan(page_stats& pageStats, int32 despairLevel) page_daemon_full_scan(page_stats& pageStats, int32 despairLevel)
{ {
TRACE_DAEMON("page daemon: full run: free: %lu, cached: %lu, " TRACE_DAEMON("page daemon: full run: free: %" B_PRIu32 ", cached: %"
"to free: %lu\n", pageStats.totalFreePages, pageStats.cachedPages, B_PRIu32 ", to free: %" B_PRIu32 "\n", pageStats.totalFreePages,
pageStats.unsatisfiedReservations + sFreeOrCachedPagesTarget pageStats.cachedPages, pageStats.unsatisfiedReservations
+ sFreeOrCachedPagesTarget
- (pageStats.totalFreePages + pageStats.cachedPages)); - (pageStats.totalFreePages + pageStats.cachedPages));
// Walk the inactive list and transfer pages to the cached and modified // Walk the inactive list and transfer pages to the cached and modified