Skip to content

Commit cb78c27

Browse files
Add tracing
1 parent 8cd5875 commit cb78c27

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

services/util/FlashEcho.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "services/util/FlashEcho.hpp"
2+
#include "services/tracer/GlobalTracer.hpp"
23
#include <utility>
34

45
namespace services
@@ -13,8 +14,14 @@ namespace services
1314
{
1415
onStopped = onDone;
1516

17+
services::GlobalTracer().Trace() << "==== FlashEcho Stop";
18+
1619
if (!busy)
20+
{
21+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 1";
22+
1723
onStopped();
24+
}
1825
}
1926

2027
void FlashEcho::Read(uint32_t address, uint32_t size)
@@ -23,14 +30,20 @@ namespace services
2330

2431
flash.ReadBuffer(infra::Head(infra::MakeRange(buffer), size), address, [this, size]()
2532
{
33+
if (onStopped)
34+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 2";
35+
2636
if (onStopped)
2737
{
38+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 3";
2839
busy = false;
2940
onStopped();
3041
}
3142
else
3243
flashResult.RequestSend([this, size]()
3344
{
45+
if (onStopped)
46+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 4";
3447
busy = false;
3548
flashResult.ReadDone(infra::Head(infra::MakeRange(buffer), size));
3649
MethodDone();
@@ -45,16 +58,22 @@ namespace services
4558
{
4659
busy = true;
4760

61+
if (onStopped)
62+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 5";
63+
4864
flash.WriteBuffer(contents, address, [this]()
4965
{
5066
if (onStopped)
5167
{
68+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 6";
5269
busy = false;
5370
onStopped();
5471
}
5572
else
5673
flashResult.RequestSend([this]()
5774
{
75+
if (onStopped)
76+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 7";
5877
busy = false;
5978
flashResult.WriteDone();
6079
MethodDone();
@@ -68,17 +87,22 @@ namespace services
6887
void FlashEcho::EraseSectors(uint32_t sector, uint32_t numberOfSectors)
6988
{
7089
busy = true;
90+
if (onStopped)
91+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 8";
7192

7293
flash.EraseSectors(sector, sector + numberOfSectors, [this]()
7394
{
7495
if (onStopped)
7596
{
97+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 9";
7698
busy = false;
7799
onStopped();
78100
}
79101
else
80102
flashResult.RequestSend([this]()
81103
{
104+
if (onStopped)
105+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 10";
82106
busy = false;
83107
flashResult.EraseSectorsDone();
84108
MethodDone();

0 commit comments

Comments
 (0)