Skip to content

Commit

Permalink
Lots of Logging Refactoring (microsoft#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Apr 30, 2020
1 parent 9e26a53 commit eaf136f
Show file tree
Hide file tree
Showing 75 changed files with 12,762 additions and 12,160 deletions.
6 changes: 0 additions & 6 deletions scripts/log.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ This script provides helpers for starting, stopping and canceling log collection
.PARAMETER ConvertToText
Converts the output logs to text.
.PARAMETER TmfPath
Used for converting Windows WPP logs.
.PARAMETER InstanceName
A unique name for the logging instance.
Expand Down Expand Up @@ -102,9 +99,6 @@ function Log-Stop {
if ($ConvertToText) {
$LogPath = Join-Path $OutputDirectory "quic.log"
$Command = "netsh trace convert $($EtlPath) output=$($LogPath) overwrite=yes report=no"
if ($TmfPath -ne "") {
$Command += " tmfpath=$($TmfPath)"
}
Invoke-Expression $Command
}
} else {
Expand Down
9 changes: 2 additions & 7 deletions src/bin/winkernel/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#include "quic_platform.h"
#include "quic_trace.h"

#ifdef QUIC_LOGS_WPP
#include "driver.tmh"
#endif

INITCODE
_IRQL_requires_max_(PASSIVE_LEVEL)
void
Expand Down Expand Up @@ -117,8 +113,8 @@ EvtDriverUnload(
Routine Description:
EvtDriverUnload will clean up the WPP resources that was allocated
for this driver.
EvtDriverUnload will clean up any resources that were allocated for this
driver.
Arguments:
Expand All @@ -130,6 +126,5 @@ Routine Description:

PAGED_CODE();
MsQuicLibraryUnload();

QuicPlatformSystemUnload();
}
11 changes: 6 additions & 5 deletions src/core/ack_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@

#include "precomp.h"

#ifdef QUIC_LOGS_WPP
#include "ack_tracker.tmh"
#endif

_IRQL_requires_max_(DISPATCH_LEVEL)
QUIC_STATUS
QuicAckTrackerInitialize(
Expand Down Expand Up @@ -144,7 +140,12 @@ QuicAckTrackerAckPacket(
return;
}

QuicTraceLogVerbose("[%c][RX][%llu] Marked for ACK", PtkConnPre(Connection), PacketNumber);
QuicTraceLogVerbose(
PacketRxMarkedForAck,
"[%c][RX][%llu] Marked for ACK",
PtkConnPre(Connection),
PacketNumber);

QuicRangeValidate(&Tracker->PacketNumbersToAck);

BOOLEAN NewLargestPacketNumber =
Expand Down
4 changes: 0 additions & 4 deletions src/core/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

#include "precomp.h"

#ifdef QUIC_LOGS_WPP
#include "api.tmh"
#endif

#define IS_SESSION_HANDLE(Handle) \
( \
(Handle) != NULL && (Handle)->Type == QUIC_HANDLE_TYPE_SESSION \
Expand Down
42 changes: 30 additions & 12 deletions src/core/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

#include "precomp.h"

#ifdef QUIC_LOGS_WPP
#include "binding.tmh"
#endif

//
// Make sure we will always have enough room to fit our Version Negotiation packet,
// which includes both the global, constant list of supported versions and the
Expand Down Expand Up @@ -295,7 +291,9 @@ QuicBindingRegisterListener(
}

if (QuicSessionHasAlpnOverlap(NewListener->Session, ExistingListener->Session)) {
QuicTraceLogWarning("[bind][%p] Listener (%p) already registered on ALPN",
QuicTraceLogWarning(
BindingListenerAlreadyRegistered,
"[bind][%p] Listener (%p) already registered on ALPN",
Binding, ExistingListener);
AddNewListener = FALSE;
break;
Expand Down Expand Up @@ -693,7 +691,9 @@ QuicBindingProcessStatelessOperation(
QuicSupportedVersionList,
sizeof(QuicSupportedVersionList));

QuicTraceLogVerbose("[S][TX][-] VN");
QuicTraceLogVerbose(
PacketTxVersionNegotiation,
"[S][TX][-] VN");

} else if (OperationType == QUIC_OPER_TYPE_STATELESS_RESET) {

Expand Down Expand Up @@ -748,7 +748,9 @@ QuicBindingProcessStatelessOperation(
RecvPacket->DestCid,
SendDatagram->Buffer + PacketLength - QUIC_STATELESS_RESET_TOKEN_LENGTH);

QuicTraceLogVerbose("[S][TX][-] SR %s",
QuicTraceLogVerbose(
PacketTxStatelessReset,
"[S][TX][-] SR %s",
QuicCidBufToStr(
SendDatagram->Buffer + PacketLength - QUIC_STATELESS_RESET_TOKEN_LENGTH,
QUIC_STATELESS_RESET_TOKEN_LENGTH
Expand Down Expand Up @@ -820,7 +822,9 @@ QuicBindingProcessStatelessOperation(
(uint8_t*)SendDatagram->Buffer);
QUIC_DBG_ASSERT(SendDatagram->Length != 0);

QuicTraceLogVerbose("[S][TX][-] LH Ver:0x%x DestCid:%s SrcCid:%s Type:R OrigDestCid:%s (Token %hu bytes)",
QuicTraceLogVerbose(
PacketTxRetry,
"[S][TX][-] LH Ver:0x%x DestCid:%s SrcCid:%s Type:R OrigDestCid:%s (Token %hu bytes)",
RecvPacket->LH->Version,
QuicCidBufToStr(RecvPacket->SourceCid, RecvPacket->SourceCidLen).Buffer,
QuicCidBufToStr(NewDestCid, MsQuicLib.CidTotalLength).Buffer,
Expand Down Expand Up @@ -1473,11 +1477,18 @@ QuicBindingSendTo(
RemoteAddress,
SendContext);
if (QUIC_FAILED(Status)) {
QuicTraceLogWarning("[bind][%p] SendTo failed, 0x%x", Binding, Status);
QuicTraceLogWarning(
BindingSendToFailed,
"[bind][%p] SendTo failed, 0x%x",
Binding,
Status);
}
#if QUIC_SEND_FAKE_LOSS
} else {
QuicTraceLogVerbose("[bind][%p] Dropped (fake loss) packet", Binding);
QuicTraceLogVerbose(
BindingSendToFakeDrop,
"[bind][%p] Dropped (fake loss) packet",
Binding);
QuicDataPathBindingFreeSendContext(SendContext);
Status = QUIC_STATUS_SUCCESS;
}
Expand Down Expand Up @@ -1507,11 +1518,18 @@ QuicBindingSendFromTo(
RemoteAddress,
SendContext);
if (QUIC_FAILED(Status)) {
QuicTraceLogWarning("[bind][%p] SendFromTo failed, 0x%x", Binding, Status);
QuicTraceLogWarning(
BindingSendFromToFailed,
"[bind][%p] SendFromTo failed, 0x%x",
Binding,
Status);
}
#if QUIC_SEND_FAKE_LOSS
} else {
QuicTraceLogVerbose("[bind][%p] Dropped (fake loss) packet", Binding);
QuicTraceLogVerbose(
SendFromToFakeDrop,
"[bind][%p] Dropped (fake loss) packet",
Binding);
QuicDataPathBindingFreeSendContext(SendContext);
Status = QUIC_STATUS_SUCCESS;
}
Expand Down
4 changes: 0 additions & 4 deletions src/core/congestion_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Future work:

#include "precomp.h"

#ifdef QUIC_LOGS_WPP
#include "congestion_control.tmh"
#endif

//
// BETA and C from RFC8312. 10x multiples for integer arithmetic.
//
Expand Down
Loading

0 comments on commit eaf136f

Please sign in to comment.