Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Shepherd-Chibby
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dorababu A
Shepherd-Chibby
Commits
e321e5d3
Commit
e321e5d3
authored
1 year ago
by
Dorababu A
Browse files
Options
Downloads
Patches
Plain Diff
read and serial print runtime stats
- using a freeRTOS function `vTaskGetRunTimeStats()`
parent
0e8ec6f1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shepherd/shepherd_sniff.c
+14
-7
14 additions, 7 deletions
shepherd/shepherd_sniff.c
src/main.cpp
+15
-1
15 additions, 1 deletion
src/main.cpp
with
29 additions
and
8 deletions
shepherd/shepherd_sniff.c
+
14
−
7
View file @
e321e5d3
...
...
@@ -4,11 +4,11 @@
#include
"esp_flash.h"
#include
"esp_flash_encrypt.h"
#include
"esp_freertos_hooks.h"
#include
"esp_wifi.h"
#include
"freertos/FreeRTOS.h"
#include
"freertos/task.h"
#include
"sdkconfig.h"
#include
<inttypes.h>
#include
"esp_wifi.h"
// Shepehrd task to print metrics
static
void
shepherd_task
(
void
*
args
)
{
...
...
@@ -39,12 +39,19 @@ static void shepherd_task(void *args) {
mode
==
ESP_FLASH_ENC_MODE_DEVELOPMENT
?
"DEVELOPMENT"
:
"RELEASE"
);
}
// wifi connection status
// wifi connection status
wifi_mode_t
wifi_mode
;
if
(
esp_wifi_get_mode
(
&
wifi_mode
)
==
ESP_ERR_WIFI_NOT_INIT
){
printf
(
"WiFI Status : disabled
\n
"
);
}
else
printf
(
"WiFi Status : Enabled"
);
if
(
esp_wifi_get_mode
(
&
wifi_mode
)
==
ESP_ERR_WIFI_NOT_INIT
)
{
printf
(
"WiFI Status : disabled
\n
"
);
}
else
printf
(
"WiFi Status : Enabled
\n
"
);
// Runtime Stats
/*
char pbuf[100];
vTaskGetRunTimeStats(pbuf);
printf("Run Time stats \n%s/r/n", pbuf);
*/
printf
(
"-----------------------------------------
\n
"
);
vTaskDelay
(
15000
/
portTICK_PERIOD_MS
);
}
vTaskDelete
(
NULL
);
...
...
@@ -52,6 +59,6 @@ static void shepherd_task(void *args) {
esp_err_t
shepherd_sniff
()
{
// TODO calculate optimal stack size
xTaskCreate
(
shepherd_task
,
"shepherd_task"
,
2048
,
NULL
,
1
,
NULL
);
xTaskCreate
(
shepherd_task
,
"shepherd_task"
,
2048
,
NULL
,
4
,
NULL
);
return
ESP_OK
;
}
This diff is collapsed.
Click to expand it.
src/main.cpp
+
15
−
1
View file @
e321e5d3
...
...
@@ -41,9 +41,23 @@ void blinky(void *pvParameter) {
}
}
void
run_time_stats
(
void
*
pvParameter
)
{
while
(
1
)
{
// Runtime Stats
printf
(
"--------Run time stats ---------------
\n
"
);
char
pbuf
[
100
];
vTaskGetRunTimeStats
(
pbuf
);
printf
(
"%s
\r\n
"
,
pbuf
);
printf
(
"---------------------------------------
\n
"
);
vTaskDelay
(
15000
/
portTICK_PERIOD_MS
);
}
}
extern
"C"
{
void
app_main
()
{
shepherd_sniff
();
xTaskCreate
(
&
blinky
,
"blinky"
,
4098
,
NULL
,
5
,
NULL
);
xTaskCreate
(
&
blinky
,
"blinky"
,
4098
,
NULL
,
1
,
NULL
);
xTaskCreate
(
&
run_time_stats
,
"run_time_stats"
,
2096
,
NULL
,
2
,
NULL
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment