[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 2/2] Add ETW Enter/Exit calls on most interface functions
Add coarse grained ETW tracing, to trace interface method timings Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx> --- src/xenbus/balloon.c | 2 ++ src/xenbus/cache.c | 11 +++++++++++ src/xenbus/gnttab.c | 13 +++++++++++++ src/xenbus/range_set.c | 11 ++++++++++- src/xenbus/shared_info.c | 2 ++ src/xenbus/store.c | 32 +++++++++++++++++++++++++++++++- 6 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c index 8d7e2c2..d1b239c 100644 --- a/src/xenbus/balloon.c +++ b/src/xenbus/balloon.c @@ -788,6 +788,7 @@ BalloonAdjust( PXENBUS_BALLOON_CONTEXT Context = Interface->Context; NTSTATUS status; + EtwEnter(); ASSERT3U(KeGetCurrentIrql(), <, DISPATCH_LEVEL); Info("====> (%llu page(s))\n", Context->Size); @@ -807,6 +808,7 @@ BalloonAdjust( Context->Size, __BalloonStatus(status)); + EtwExit2(status); return status; } diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c index 6229aed..11d857a 100644 --- a/src/xenbus/cache.c +++ b/src/xenbus/cache.c @@ -600,6 +600,8 @@ CacheGet( PVOID Object; LONG ObjectCount; + EtwEnter(); + UNREFERENCED_PARAMETER(Interface); ASSERT(Cache != NULL); @@ -661,6 +663,7 @@ done: KeLowerIrql(Irql); + EtwExit(); return Object; } @@ -678,6 +681,8 @@ CachePut( PXENBUS_CACHE_SLAB Slab; NTSTATUS status; + EtwEnter(); + UNREFERENCED_PARAMETER(Interface); ASSERT(Cache != NULL); @@ -720,6 +725,8 @@ done: InterlockedDecrement(&Cache->CurrentObjects); KeLowerIrql(Irql); + + EtwExit(); } static NTSTATUS @@ -731,6 +738,7 @@ CacheFill( KIRQL Irql; NTSTATUS status; + EtwEnter(); KeRaiseIrql(DISPATCH_LEVEL, &Irql); __CacheAcquireLock(Cache); @@ -746,6 +754,7 @@ CacheFill( __CacheReleaseLock(Cache); KeLowerIrql(Irql); + EtwExit2(status); return status; } @@ -758,6 +767,7 @@ CacheSpill( KIRQL Irql; PLIST_ENTRY ListEntry; + EtwEnter(); KeRaiseIrql(DISPATCH_LEVEL, &Irql); __CacheAcquireLock(Cache); @@ -792,6 +802,7 @@ CacheSpill( done: __CacheReleaseLock(Cache); KeLowerIrql(Irql); + EtwExit(); } static FORCEINLINE VOID diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c index 4f6617b..5ef7cc8 100644 --- a/src/xenbus/gnttab.c +++ b/src/xenbus/gnttab.c @@ -511,6 +511,7 @@ GnttabPermitForeignAccess( ULONG Index; NTSTATUS status; + EtwEnter(); *Entry = XENBUS_CACHE(Get, &Context->CacheInterface, Cache->Cache, @@ -538,11 +539,13 @@ GnttabPermitForeignAccess( Frame->Entry[Index].flags |= GTF_permit_access; KeMemoryBarrier(); + EtwExit(); return STATUS_SUCCESS; fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } @@ -561,6 +564,8 @@ GnttabRevokeForeignAccess( ULONG Attempt; NTSTATUS status; + EtwEnter(); + ASSERT3U(Entry->Magic, ==, XENBUS_GNTTAB_ENTRY_MAGIC); ASSERT3U(Entry->Reference, >=, XENBUS_GNTTAB_RESERVED_ENTRY_COUNT); ASSERT3U(Entry->Reference, <, (Context->FrameIndex + 1) * XENBUS_GNTTAB_ENTRY_PER_FRAME); @@ -599,11 +604,13 @@ GnttabRevokeForeignAccess( Entry, Locked); + EtwExit(); return STATUS_SUCCESS; fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } @@ -671,6 +678,7 @@ GnttabMapForeignPages( PXENBUS_GNTTAB_MAP_ENTRY MapEntry; NTSTATUS status; + EtwEnter(); Mdl = FdoHoleAllocate(Context->Fdo, NumberPages); status = STATUS_NO_MEMORY; @@ -708,6 +716,7 @@ GnttabMapForeignPages( if (!NT_SUCCESS(status)) goto fail4; + EtwExit(); return STATUS_SUCCESS; fail4: @@ -734,6 +743,7 @@ fail2: fail1: Error("fail1: (%08x)\n", status); + EtwExit2(status); return status; } @@ -751,6 +761,7 @@ GnttabUnmapForeignPages( PMDL Mdl; NTSTATUS status; + EtwEnter(); status = HashTableLookup(Context->MapTable, (ULONG_PTR)Address.QuadPart, (PULONG_PTR)&MapEntry); @@ -779,6 +790,7 @@ GnttabUnmapForeignPages( FdoHoleFree(Context->Fdo, Mdl); + EtwExit(); return STATUS_SUCCESS; fail2: @@ -787,6 +799,7 @@ fail2: fail1: Error("fail1: (%08x)\n", status); + EtwExit2(status); return status; } diff --git a/src/xenbus/range_set.c b/src/xenbus/range_set.c index 08af0db..dd7277c 100644 --- a/src/xenbus/range_set.c +++ b/src/xenbus/range_set.c @@ -195,6 +195,7 @@ RangeSetPop( UNREFERENCED_PARAMETER(Interface); + EtwEnter(); status = STATUS_INVALID_PARAMETER; if (Count == 0) @@ -234,6 +235,7 @@ found: KeReleaseSpinLock(&RangeSet->Lock, Irql); + EtwExit(); return STATUS_SUCCESS; fail3: @@ -247,6 +249,7 @@ fail2: fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } @@ -337,6 +340,7 @@ RangeSetGet( UNREFERENCED_PARAMETER(Interface); + EtwEnter(); status = STATUS_INVALID_PARAMETER; if (Count == 0) @@ -407,6 +411,7 @@ done: KeReleaseSpinLock(&RangeSet->Lock, Irql); + EtwExit(); return STATUS_SUCCESS; fail2: @@ -417,7 +422,8 @@ fail2: fail1: Error("fail1 (%08x)\n", status); - return status; + EtwExit2(status); + return status; } static NTSTATUS @@ -519,6 +525,7 @@ RangeSetPut( UNREFERENCED_PARAMETER(Interface); + EtwEnter(); status = STATUS_INVALID_PARAMETER; if (Count == 0) @@ -552,6 +559,7 @@ RangeSetPut( KeReleaseSpinLock(&RangeSet->Lock, Irql); + EtwExit(); return STATUS_SUCCESS; fail2: @@ -562,6 +570,7 @@ fail2: fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } diff --git a/src/xenbus/shared_info.c b/src/xenbus/shared_info.c index dc456eb..10ac7a6 100644 --- a/src/xenbus/shared_info.c +++ b/src/xenbus/shared_info.c @@ -362,6 +362,7 @@ SharedInfoGetTime( TIME_FIELDS TimeFields; KIRQL Irql; + EtwEnter(); // Make sure we don't suspend KeRaiseIrql(DISPATCH_LEVEL, &Irql); @@ -439,6 +440,7 @@ SharedInfoGetTime( if ( Local ) *Local = !SystemRealTimeIsUniversal(); + EtwExit(); #undef NS_PER_S } diff --git a/src/xenbus/store.c b/src/xenbus/store.c index 02d3cc2..714049c 100644 --- a/src/xenbus/store.c +++ b/src/xenbus/store.c @@ -1104,7 +1104,8 @@ StoreRead( PXENBUS_STORE_BUFFER Buffer; NTSTATUS status; - (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL); + EtwEnter(); + (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL); RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)); @@ -1156,6 +1157,7 @@ StoreRead( *Value = Buffer->Data; + EtwExit(); return STATUS_SUCCESS; fail4: @@ -1166,6 +1168,7 @@ fail2: fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -1183,6 +1186,7 @@ StoreWrite( PXENBUS_STORE_RESPONSE Response; NTSTATUS status; + EtwEnter(); RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)); KeAcquireSpinLock(&Context->Lock, &Irql); @@ -1227,6 +1231,7 @@ StoreWrite( StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit(); return STATUS_SUCCESS; fail3: @@ -1236,6 +1241,7 @@ fail2: fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -1311,6 +1317,8 @@ StorePrintf( va_list Arguments; NTSTATUS status; + EtwEnter(); + va_start(Arguments, Format); status = StoreVPrintf(Interface, Transaction, @@ -1320,6 +1328,7 @@ StorePrintf( Arguments); va_end(Arguments); + EtwExit2(status); return status; } @@ -1337,6 +1346,7 @@ StoreRemove( PXENBUS_STORE_RESPONSE Response; NTSTATUS status; + EtwEnter(); RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)); KeAcquireSpinLock(&Context->Lock, &Irql); @@ -1379,6 +1389,7 @@ StoreRemove( StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit(); return STATUS_SUCCESS; fail3: @@ -1388,6 +1399,7 @@ fail2: fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -1408,6 +1420,7 @@ StoreDirectory( PXENBUS_STORE_BUFFER Buffer; NTSTATUS status; + EtwEnter(); (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL); RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)); @@ -1464,6 +1477,7 @@ StoreDirectory( *Value = Buffer->Data; + EtwExit(); return STATUS_SUCCESS; fail5: @@ -1477,6 +1491,7 @@ fail2: fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -1492,6 +1507,7 @@ StoreTransactionStart( KIRQL Irql; NTSTATUS status; + EtwEnter(); *Transaction = __StoreAllocate(sizeof (XENBUS_STORE_TRANSACTION)); status = STATUS_NO_MEMORY; @@ -1539,6 +1555,7 @@ StoreTransactionStart( InsertTailList(&Context->TransactionList, &(*Transaction)->ListEntry); KeReleaseSpinLock(&Context->Lock, Irql); + EtwExit(); return STATUS_SUCCESS; fail3: @@ -1559,6 +1576,7 @@ fail2: fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } @@ -1575,6 +1593,7 @@ StoreTransactionEnd( KIRQL Irql; NTSTATUS status; + EtwEnter(); ASSERT3U(Transaction->Magic, ==, STORE_TRANSACTION_MAGIC); RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)); @@ -1626,6 +1645,7 @@ done: ASSERT(IsZeroMemory(Transaction, sizeof (XENBUS_STORE_TRANSACTION))); __StoreFree(Transaction); + EtwExit2(status); return status; fail2: @@ -1636,6 +1656,7 @@ fail2: fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -1657,6 +1678,7 @@ StoreWatchAdd( KIRQL Irql; NTSTATUS status; + EtwEnter(); *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH)); status = STATUS_NO_MEMORY; @@ -1730,6 +1752,7 @@ StoreWatchAdd( StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit(); return STATUS_SUCCESS; fail4: @@ -1767,6 +1790,7 @@ fail2: fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } @@ -1784,6 +1808,7 @@ StoreWatchRemove( KIRQL Irql; NTSTATUS status; + EtwEnter(); ASSERT3U(Watch->Magic, ==, STORE_WATCH_MAGIC); Path = Watch->Path; @@ -1851,6 +1876,7 @@ done: ASSERT(IsZeroMemory(Watch, sizeof (XENBUS_STORE_WATCH))); __StoreFree(Watch); + EtwExit(); return STATUS_SUCCESS; fail2: @@ -1863,6 +1889,7 @@ fail1: ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); + EtwExit2(status); return status; } @@ -2041,6 +2068,7 @@ StorePermissionsSet( PCHAR PermissionString; PCHAR Segment; + EtwEnter(); PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX); status = STATUS_NO_MEMORY; @@ -2110,6 +2138,7 @@ StorePermissionsSet( __StoreFree(Path); __StoreFree(PermissionString); + EtwExit(); return STATUS_SUCCESS; fail6: @@ -2136,6 +2165,7 @@ fail2: fail1: Error("fail1 (%08x)\n", status); + EtwExit2(status); return status; } -- 2.41.0.windows.3
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |