forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6caecf
commit 8e1500e
Showing
8 changed files
with
179 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ dependencies: | |
version: "2.0.3" | ||
rules: | ||
- if: "idf_version >=4.4" | ||
|
||
espressif/esp_insights: | ||
version: "1.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
#Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
import("//build_overrides/build.gni") | ||
import("//build_overrides/chip.gni") | ||
|
||
config("tracing") { | ||
include_dirs = [ "include" ] | ||
} | ||
|
||
source_set("esp32_trace") { | ||
public = [ "include/matter/tracing/macros_impl.h" ] | ||
sources = ["include/matter/tracing/macros_impl.cpp"] | ||
public_configs = [ ":tracing" ] | ||
public_deps = [ "${chip_root}/src/system" ] | ||
} | ||
|
||
|
73 changes: 73 additions & 0 deletions
73
src/tracing/esp32_trace/include/matter/tracing/macros_impl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
#include "macros_impl.h" | ||
#include <esp_insights.h> | ||
#include "esp_heap_caps.h" | ||
//#include <system/SystemClock.h> | ||
|
||
namespace Insights { | ||
|
||
ESP32Backend::ESP32Backend(const char * str, ...) | ||
{ | ||
va_list args; | ||
va_start(args, str); | ||
var1 = str; | ||
var2= va_arg(args,const char *); | ||
|
||
if (var2 != NULL) | ||
{ | ||
ESP_DIAG_EVENT("MTR_TRC", "Entry - %s - %s", var1, var2); | ||
} | ||
else | ||
{ | ||
ESP_DIAG_EVENT("MTR_TRC", "Entry - %s", var1); | ||
} | ||
|
||
// chip::System::Clock::Timestamp start = chip::System::SystemClock().GetMonotonicTimestamp(); | ||
// start_time = chip::System::Clock::Milliseconds32(start).count(); | ||
int start_min_heap =heap_caps_get_minimum_free_size(MALLOC_CAP_8BIT); | ||
int largest_free_block = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
int start_free_heap = heap_caps_get_free_size(MALLOC_CAP_8BIT); | ||
//ESP_DIAG_EVENT("MTR_TRC","Start time - %5lu Start Min Free heap - %5d - Largest Free Block - %5d Start free heap -%5d ", start_time, start_min_heap, largest_free_block, start_free_heap); | ||
ESP_DIAG_EVENT("MTR_TRC", " Start Min Free heap - %5d - Largest Free Block - %5d Start free heap -%5d", start_min_heap, largest_free_block, start_free_heap); | ||
|
||
} | ||
|
||
ESP32Backend::~ESP32Backend() | ||
{ | ||
if(var2!=NULL) | ||
{ | ||
ESP_DIAG_EVENT("MTR_TRC", "Exit - %s - %s", var1, var2); | ||
} | ||
else | ||
{ | ||
ESP_DIAG_EVENT("MTR_TRC", "Exit - %s", var1); | ||
} | ||
|
||
//chip::System::Clock::Timestamp end = chip::System::SystemClock().GetMonotonicTimestamp(); | ||
//long unsigned int end_time = chip::System::Clock::Milliseconds32(end).count(); | ||
//long unsigned int time_elapsed = end_time -start_time; | ||
int end_minimum_free_heap = heap_caps_get_minimum_free_size(MALLOC_CAP_8BIT); | ||
int end_largest_free_block = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
int end_free_heap = heap_caps_get_free_size(MALLOC_CAP_8BIT); | ||
//ESP_DIAG_EVENT("MTR_TRC","Time Elapsed - %5lu - End Min Free heap - %5d - End Largest Free Block %5d - End free Heap - %5d",time_elapsed, end_minimum_free_heap, end_largest_free_block, end_free_heap); | ||
ESP_DIAG_EVENT("MTR_TRC","- End Min Free heap - %5d - End Largest Free Block %5d - End free Heap - %5d", end_minimum_free_heap, end_largest_free_block, end_free_heap); | ||
|
||
} | ||
}//Insights | ||
|
53 changes: 53 additions & 0 deletions
53
src/tracing/esp32_trace/include/matter/tracing/macros_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
/* Ensure we do not have double tracing macros defined */ | ||
#if defined(MATTER_TRACE_BEGIN) | ||
#error "Tracing macros seem to be double defined" | ||
#endif | ||
|
||
namespace Insights { | ||
class ESP32Backend { | ||
public: | ||
ESP32Backend(const char* str, ...); | ||
~ESP32Backend(); | ||
|
||
private: | ||
//long unsigned int start_time; | ||
const char* var1; | ||
const char* var2; | ||
}; | ||
} | ||
|
||
#define MATTER_TRACE_SCOPE(...) \ | ||
do { \ | ||
Insights::ESP32Backend backend(__VA_ARGS__); \ | ||
} while (0) | ||
|
||
|
||
#define _MATTER_TRACE_DISABLE(...) \ | ||
do \ | ||
{ \ | ||
} while (false) | ||
|
||
#define MATTER_TRACE_BEGIN(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) | ||
#define MATTER_TRACE_END(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) | ||
#define MATTER_TRACE_INSTANT(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters