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;
}
TRACE(("VMAddressSpace::Create(): team %ld (%skernel): %#lx bytes starting at "
"%#lx => %p\n", teamID, kernel ? "" : "!", size, base, addressSpace));
TRACE(("VMAddressSpace::Create(): team %" B_PRId32 " (%skernel): %#lx "
"bytes starting at %#lx => %p\n", teamID, kernel ? "" : "!", size,
base, addressSpace));
// create the corresponding translation map
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)
{
TRACE("%p->VMAnonymousCache::Init(canOvercommit = %s, "
"numPrecommittedPages = %ld, numGuardPages = %ld)\n", this,
canOvercommit ? "yes" : "no", numPrecommittedPages, numGuardPages);
"numPrecommittedPages = %" B_PRId32 ", numGuardPages = %" B_PRId32
")\n", this, canOvercommit ? "yes" : "no", numPrecommittedPages,
numGuardPages);
status_t error = VMCache::Init(CACHE_TYPE_RAM, allocationFlags);
if (error != B_OK)
@@ -528,7 +529,7 @@ VMAnonymousCache::Resize(off_t newSize, int priority)
status_t
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
// unreserve memory, if we're asked to shrink our commitment, though.
@@ -950,8 +951,9 @@ VMAnonymousCache::_SwapBlockGetAddress(off_t pageIndex)
status_t
VMAnonymousCache::_Commit(off_t size, int priority)
{
TRACE("%p->VMAnonymousCache::_Commit(%lld), already committed: %lld "
"(%lld swap)\n", this, size, committed_size, fCommittedSwapSize);
TRACE("%p->VMAnonymousCache::_Commit(%" B_PRIdOFF "), already committed: "
"%" B_PRIdOFF " (%" B_PRIdOFF " swap)\n", this, size, committed_size,
fCommittedSwapSize);
// Basic strategy: reserve swap space first, only when running out of swap
// space, reserve real memory.
@@ -965,8 +967,8 @@ VMAnonymousCache::_Commit(off_t size, int priority)
fCommittedSwapSize += swap_space_reserve(size - fCommittedSwapSize);
committed_size = fCommittedSwapSize + committedMemory;
if (size > fCommittedSwapSize) {
TRACE("%p->VMAnonymousCache::_Commit(%lld), reserved only %lld "
"swap\n", this, size, fCommittedSwapSize);
TRACE("%p->VMAnonymousCache::_Commit(%" B_PRIdOFF "), reserved "
"only %" B_PRIdOFF " swap\n", this, size, fCommittedSwapSize);
}
}
+8 -8
View File
@@ -679,7 +679,7 @@ VMCache::Delete()
page->SetCacheRef(NULL);
TRACE(("vm_cache_release_ref: freeing page 0x%lx\n",
oldPage->physical_page_number));
page->physical_page_number));
DEBUG_PAGE_ACCESS_START(page);
vm_page_free(this, page);
}
@@ -769,7 +769,7 @@ VMCache::LookupPage(off_t offset)
void
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));
AssertLocked();
@@ -928,7 +928,7 @@ VMCache::WaitForPageEvents(vm_page* page, uint32 events, bool relock)
void
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();
consumer->AssertLocked();
@@ -1054,8 +1054,8 @@ VMCache::WriteModified()
status_t
VMCache::SetMinimalCommitment(off_t commitment, int priority)
{
TRACE(("VMCache::SetMinimalCommitment(cache %p, commitment %Ld)\n",
this, commitment));
TRACE(("VMCache::SetMinimalCommitment(cache %p, commitment %" B_PRIdOFF
")\n", this, commitment));
AssertLocked();
T(SetMinimalCommitment(this, commitment));
@@ -1088,8 +1088,8 @@ VMCache::SetMinimalCommitment(off_t commitment, int priority)
status_t
VMCache::Resize(off_t newSize, int priority)
{
TRACE(("VMCache::Resize(cache %p, newSize %Ld) old size %Ld\n",
this, newSize, this->virtual_end));
TRACE(("VMCache::Resize(cache %p, newSize %" B_PRIdOFF ") old size %"
B_PRIdOFF "\n", this, newSize, this->virtual_end));
this->AssertLocked();
T(Resize(this, newSize));
@@ -1400,7 +1400,7 @@ VMCache::_MergeWithOnlyConsumer()
{
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));
T(Merge(this, consumer));
@@ -151,7 +151,7 @@ VMKernelAddressSpace::CreateArea(const char* name, uint32 wiring,
void
VMKernelAddressSpace::DeleteArea(VMArea* _area, uint32 allocationFlags)
{
TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", area);
TRACE("VMKernelAddressSpace::DeleteArea(%p)\n", _area);
VMKernelArea* area = static_cast<VMKernelArea*>(_area);
object_cache_delete(fAreaObjectCache, area);
+28 -24
View File
@@ -60,7 +60,7 @@
//#define TRACE_VM
//#define TRACE_FAULTS
#define TRACE_FAULTS
#ifdef TRACE_VM
# define TRACE(x) dprintf x
#else
@@ -784,10 +784,11 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,
uint32 flags, const virtual_address_restrictions* addressRestrictions,
bool kernel, VMArea** _area, void** _virtualAddress)
{
TRACE(("map_backing_store: aspace %p, cache %p, virtual %p, offset 0x%Lx, "
"size %lu, addressSpec %ld, wiring %d, protection %d, area %p, areaName "
"'%s'\n", addressSpace, cache, addressRestrictions->address, offset,
size, addressRestrictions->address_specification, wiring, protection,
TRACE(("map_backing_store: aspace %p, cache %p, virtual %p, offset 0x%"
B_PRIx64 ", size %" B_PRIuADDR ", addressSpec %" B_PRIu32 ", wiring %d"
", protection %d, area %p, areaName '%s'\n", addressSpace, cache,
addressRestrictions->address, offset, size,
addressRestrictions->address_specification, wiring, protection,
_area, areaName));
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
? 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);
@@ -1557,10 +1559,10 @@ vm_map_physical_memory(team_id team, const char* name, void** _address,
VMCache* cache;
addr_t mapOffset;
TRACE(("vm_map_physical_memory(aspace = %ld, \"%s\", virtual = %p, "
"spec = %ld, size = %lu, protection = %ld, phys = %#" B_PRIxPHYSADDR
")\n", team, name, *_address, addressSpec, size, protection,
physicalAddress));
TRACE(("vm_map_physical_memory(aspace = %" B_PRId32 ", \"%s\", virtual = %p"
", spec = %" B_PRIu32 ", size = %" B_PRIxADDR ", protection = %"
B_PRIu32 ", phys = %#" B_PRIxPHYSADDR ")\n", team, name, *_address,
addressSpec, size, protection, physicalAddress));
if (!arch_vm_supports_protection(protection))
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,
struct generic_io_vec* vecs, uint32 vecCount)
{
TRACE(("vm_map_physical_memory_vecs(team = %ld, \"%s\", virtual = %p, "
"spec = %ld, _size = %p, protection = %ld, vecs = %p, "
"vecCount = %ld)\n", team, name, *_address, addressSpec, _size,
protection, vecs, vecCount));
TRACE(("vm_map_physical_memory_vecs(team = %" B_PRId32 ", \"%s\", virtual "
"= %p, spec = %" B_PRIu32 ", _size = %p, protection = %" B_PRIu32 ", "
"vecs = %p, vecCount = %" B_PRIu32 ")\n", team, name, *_address,
addressSpec, _size, protection, vecs, vecCount));
if (!arch_vm_supports_protection(protection)
|| (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
// make it into the mapped copy -- this will need quite some changes
// to be done in a nice way
TRACE(("_vm_map_file(fd = %d, offset = %Ld, size = %lu, mapping %ld)\n",
fd, offset, size, mapping));
TRACE(("_vm_map_file(fd = %d, offset = %" B_PRIdOFF ", size = %lu, mapping "
"%" B_PRIu32 ")\n", fd, offset, size, mapping));
offset = ROUNDDOWN(offset, B_PAGE_SIZE);
size = PAGE_ALIGN(size);
@@ -2249,7 +2251,8 @@ delete_area(VMAddressSpace* addressSpace, VMArea* area,
status_t
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
AddressSpaceWriteLocker locker;
@@ -2520,8 +2523,8 @@ static status_t
vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection,
bool kernel)
{
TRACE(("vm_set_area_protection(team = %#lx, area = %#lx, protection = "
"%#lx)\n", team, areaID, newProtection));
TRACE(("vm_set_area_protection(team = %#" B_PRIx32 ", area = %#" B_PRIx32
", protection = %#" B_PRIx32 ")\n", team, areaID, newProtection));
if (!arch_vm_supports_protection(newProtection))
return B_NOT_SUPPORTED;
@@ -3405,7 +3408,7 @@ dump_available_memory(int argc, char** argv)
void
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->WriteLock();
@@ -4365,8 +4368,9 @@ static status_t
vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
bool isWrite, bool isUser, vm_page** wirePage, VMAreaWiredRange* wiredRange)
{
FTRACE(("vm_soft_fault: thid 0x%lx address 0x%lx, isWrite %d, isUser %d\n",
thread_get_current_thread_id(), originalAddress, isWrite, isUser));
FTRACE(("vm_soft_fault: thid 0x%" B_PRIx32 " address 0x%" B_PRIxADDR ", "
"isWrite %d, isUser %d\n", thread_get_current_thread_id(),
originalAddress, isWrite, isUser));
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;
bool interrupts = are_interrupts_enabled();
TRACE(("get_memory_map_etc(%ld, %p, %lu bytes, %ld entries)\n", team,
address, numBytes, numEntries));
TRACE(("get_memory_map_etc(%" B_PRId32 ", %p, %lu bytes, %" B_PRIu32 " "
"entries)\n", team, address, numBytes, numEntries));
if (numEntries == 0 || numBytes == 0)
return B_BAD_VALUE;
+13 -11
View File
@@ -2449,8 +2449,8 @@ page_writer(void* /*unused*/)
writtenPages += numPages;
if (writtenPages >= 1024) {
bigtime_t now = system_time();
TRACE(("page writer: wrote 1024 pages (total: %llu ms, "
"collect: %llu ms, write: %llu ms)\n",
TRACE(("page writer: wrote 1024 pages (total: %" B_PRIu64 " ms, "
"collect: %" B_PRIu64 " ms, write: %" B_PRIu64 " ms)\n",
(now - lastWrittenTime) / 1000,
pageCollectionTime / 1000, pageWritingTime / 1000));
lastWrittenTime = now;
@@ -2808,9 +2808,10 @@ full_scan_inactive_pages(page_stats& pageStats, int32 despairLevel)
queueLocker.Unlock();
time = system_time() - time;
TRACE_DAEMON(" -> inactive scan (%7lld us): scanned: %7lu, "
"moved: %lu -> cached, %lu -> modified, %lu -> active\n", time,
pagesScanned, pagesToCached, pagesToModified, pagesToActive);
TRACE_DAEMON(" -> inactive scan (%7" B_PRId64 " us): scanned: %7" B_PRIu32
", moved: %" B_PRIu32 " -> cached, %" B_PRIu32 " -> modified, %"
B_PRIu32 " -> active\n", time, pagesScanned, pagesToCached,
pagesToModified, pagesToActive);
// wake up the page writer, if we tossed it some pages
if (pagesToModified > 0)
@@ -2904,9 +2905,9 @@ full_scan_active_pages(page_stats& pageStats, int32 despairLevel)
}
time = system_time() - time;
TRACE_DAEMON(" -> active scan (%7lld us): scanned: %7lu, "
"moved: %lu -> inactive, encountered %lu accessed ones\n", time,
pagesScanned, pagesToInactive, pagesAccessed);
TRACE_DAEMON(" -> active scan (%7" B_PRId64 " us): scanned: %7" B_PRIu32
", moved: %" B_PRIu32 " -> inactive, encountered %" B_PRIu32 " accessed"
" ones\n", time, pagesScanned, pagesToInactive, pagesAccessed);
}
@@ -2934,9 +2935,10 @@ page_daemon_idle_scan(page_stats& pageStats)
static void
page_daemon_full_scan(page_stats& pageStats, int32 despairLevel)
{
TRACE_DAEMON("page daemon: full run: free: %lu, cached: %lu, "
"to free: %lu\n", pageStats.totalFreePages, pageStats.cachedPages,
pageStats.unsatisfiedReservations + sFreeOrCachedPagesTarget
TRACE_DAEMON("page daemon: full run: free: %" B_PRIu32 ", cached: %"
B_PRIu32 ", to free: %" B_PRIu32 "\n", pageStats.totalFreePages,
pageStats.cachedPages, pageStats.unsatisfiedReservations
+ sFreeOrCachedPagesTarget
- (pageStats.totalFreePages + pageStats.cachedPages));
// Walk the inactive list and transfer pages to the cached and modified