Skip to content

Commit

Permalink
Make updated tracing scope/begin/end/instant use char* instead of enu…
Browse files Browse the repository at this point in the history
…ms (#27327)

* Create varargs macros for tracing, including tests

* Add matter trace scope macros

* Add missing semicolon

* Add labels to trace end

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Use a buildconfig header for tracing configuration

* Fix missing include

* Restyled by gn

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
3 people authored and pull[bot] committed Sep 5, 2023
1 parent b29e823 commit 1765289
Show file tree
Hide file tree
Showing 19 changed files with 251 additions and 496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler *
const Commands::ArmFailSafe::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("ArmFailSafe", "GeneralCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_ArmFailSafe);
MATTER_TRACE_SCOPE("ArmFailSafe", "GeneralCommissioning");
auto & failSafeContext = Server::GetInstance().GetFailSafeContext();
Commands::ArmFailSafeResponse::Type response;

Expand Down Expand Up @@ -219,7 +219,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(
const Commands::CommissioningComplete::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("CommissioningComplete", "GeneralCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_CommissioningComplete);
MATTER_TRACE_SCOPE("CommissioningComplete", "GeneralCommissioning");

DeviceControlServer * devCtrl = &DeviceLayer::DeviceControlServer::DeviceControlSvr();
auto & failSafe = Server::GetInstance().GetFailSafeContext();
Expand Down Expand Up @@ -287,7 +287,7 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH
const Commands::SetRegulatoryConfig::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("SetRegulatoryConfig", "GeneralCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_SetRegulatoryConfig);
MATTER_TRACE_SCOPE("SetRegulatoryConfig", "GeneralCommissioning");
DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr();
Commands::SetRegulatoryConfigResponse::Type response;

Expand Down
12 changes: 6 additions & 6 deletions src/app/clusters/network-commissioning/network-commissioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void Instance::OnNetworkingStatusChange(NetworkCommissioning::Status aCommission
void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleScanNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleScanNetwork);
MATTER_TRACE_SCOPE("HandleScanNetwork", "NetworkCommissioning");
if (mFeatureFlags.Has(Feature::kWiFiNetworkInterface))
{
ByteSpan ssid;
Expand Down Expand Up @@ -318,7 +318,7 @@ bool CheckFailSafeArmed(CommandHandlerInterface::HandlerContext & ctx)
void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleAddOrUpdateWiFiNetwork);
MATTER_TRACE_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning");

VerifyOrReturn(CheckFailSafeArmed(ctx));

Expand Down Expand Up @@ -377,7 +377,7 @@ void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands
void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleAddOrUpdateThreadNetwork);
MATTER_TRACE_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning");

VerifyOrReturn(CheckFailSafeArmed(ctx));

Expand Down Expand Up @@ -415,7 +415,7 @@ void Instance::CommitSavedBreadcrumb()
void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleRemoveNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleRemoveNetwork);
MATTER_TRACE_SCOPE("HandleRemoveNetwork", "NetworkCommissioning");

VerifyOrReturn(CheckFailSafeArmed(ctx));

Expand All @@ -438,7 +438,7 @@ void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveN
void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::ConnectNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleConnectNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleConnectNetwork);
MATTER_TRACE_SCOPE("HandleConnectNetwork", "NetworkCommissioning");
if (req.networkID.size() > DeviceLayer::NetworkCommissioning::kMaxNetworkIDLen)
{
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::InvalidValue);
Expand All @@ -457,7 +457,7 @@ void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::Connec
void Instance::HandleReorderNetwork(HandlerContext & ctx, const Commands::ReorderNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleReorderNetwork", "NetworkCommissioning");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleReorderNetwork);
MATTER_TRACE_SCOPE("HandleReorderNetwork", "NetworkCommissioning");
Commands::NetworkConfigResponse::Type response;
MutableCharSpan debugText;
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ bool emberAfOperationalCredentialsClusterRemoveFabricCallback(app::CommandHandle
const Commands::RemoveFabric::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("RemoveFabric", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_RemoveFabric);
MATTER_TRACE_SCOPE("RemoveFabric", "OperationalCredentials");
auto & fabricBeingRemoved = commandData.fabricIndex;

ChipLogProgress(Zcl, "OpCreds: Received a RemoveFabric Command for FabricIndex 0x%x",
Expand Down Expand Up @@ -470,7 +470,7 @@ bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(app::CommandH
const Commands::UpdateFabricLabel::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("UpdateFabricLabel", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_UpdateFabricLabel);
MATTER_TRACE_SCOPE("UpdateFabricLabel", "OperationalCredentials");
auto & label = commandData.label;
auto ourFabricIndex = commandObj->GetAccessingFabricIndex();
auto finalStatus = Status::Failure;
Expand Down Expand Up @@ -593,7 +593,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co
const Commands::AddNOC::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("AddNOC", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AddNOC);
MATTER_TRACE_SCOPE("AddNOC", "OperationalCredentials");
auto & NOCValue = commandData.NOCValue;
auto & ICACValue = commandData.ICACValue;
auto & adminVendorId = commandData.adminVendorId;
Expand Down Expand Up @@ -767,7 +767,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler *
const Commands::UpdateNOC::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("UpdateNOC", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_UpdateNOC);
MATTER_TRACE_SCOPE("UpdateNOC", "OperationalCredentials");
auto & NOCValue = commandData.NOCValue;
auto & ICACValue = commandData.ICACValue;

Expand Down Expand Up @@ -860,7 +860,7 @@ bool emberAfOperationalCredentialsClusterCertificateChainRequestCallback(
const Commands::CertificateChainRequest::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("CertificateChainRequest", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_CertificateChainRequest);
MATTER_TRACE_SCOPE("CertificateChainRequest", "OperationalCredentials");
auto & certificateType = commandData.certificateType;

CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -909,7 +909,7 @@ bool emberAfOperationalCredentialsClusterAttestationRequestCallback(app::Command
const Commands::AttestationRequest::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("AttestationRequest", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AttestationRequest);
MATTER_TRACE_SCOPE("AttestationRequest", "OperationalCredentials");
auto & attestationNonce = commandData.attestationNonce;

auto finalStatus = Status::Failure;
Expand Down Expand Up @@ -1006,7 +1006,7 @@ bool emberAfOperationalCredentialsClusterCSRRequestCallback(app::CommandHandler
const Commands::CSRRequest::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("CSRRequest", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_CSRRequest);
MATTER_TRACE_SCOPE("CSRRequest", "OperationalCredentials");
ChipLogProgress(Zcl, "OpCreds: Received a CSRRequest command");

chip::Platform::ScopedMemoryBuffer<uint8_t> nocsrElements;
Expand Down Expand Up @@ -1142,7 +1142,7 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback(
const Commands::AddTrustedRootCertificate::DecodableType & commandData)
{
MATTER_TRACE_EVENT_SCOPE("AddTrustedRootCertificate", "OperationalCredentials");
MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AddTrustedRootCertificate);
MATTER_TRACE_SCOPE("AddTrustedRootCertificate", "OperationalCredentials");

auto & fabricTable = Server::GetInstance().GetFabricTable();
auto finalStatus = Status::Failure;
Expand Down
Loading

0 comments on commit 1765289

Please sign in to comment.