Skip to content

Commit f57ff82

Browse files
Apply suggestions from tutorial review
Co-authored-by: Ralph Lange <ralph-lange@users.noreply.github.com>
1 parent e676eb3 commit f57ff82

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

  • _docs/tutorials/advanced/benchmarking

_docs/tutorials/advanced/benchmarking/index.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ terminology and mechanisms are a known. If this is not the case, the
3232
documentation related to the benchmarking is available in
3333
[here](https://github.com/micro-ROS/benchmarking_shadow-builder/blob/master/README.md).
3434

35-
2. Using linux, preferably Linux Ubuntu 18.04 and above, all debian based
35+
2. Using linux, preferably Ubuntu 18.04 and above, all Debian-based
3636
distros should do the job.
3737

38-
3. Some knowledge about c and c++ programing
38+
3. Some knowledge about C and C++ programming
3939

4040

4141
Once all the checkboxes ticked the tutorial can begin.
@@ -49,34 +49,34 @@ How to do so ? --> Is there a plugin already supporting it? Yes, then to do. And
4949
the code to profil can be instrumented.
5050

5151
If no plugin supports it, then a plugin has to be created.
52-
Then another set of question arise which are (according to the context):
52+
Then, another set of questions arises, which are (according to the context):
5353

54-
1. How could it benifit to many others?
55-
2. What piece of code would be used to measure the time? (in C or C++).
56-
3. What plaform can it support? (OS,CPU etc...).
57-
4. How the code shall be instrumented?
54+
1. How could it benefit to others?
55+
2. What piece of code would be used to measure the time? (In C or C++?)
56+
3. What platform can it support? (OS, CPU, etc.)
57+
4. How should the code be instrumented?
5858

5959

60-
The answers to this question would be:
60+
The answers to these questions would be:
6161

6262
1. Create a generic plugin and write a documentation that would be
6363
understandable for a normal user and an expert user.
64-
2. Using the timespec ang clock_gettime Linux syscall.
65-
3. From previous answer --> OS: Linux any cpu as long as it has the same Linux api.
64+
2. Using the `timespec` and `clock_gettime` Linux syscall.
65+
3. From previous answer --> OS: Linux on any CPU as long as it has the same Linux API.
6666
4. Using a simple way using the comment as follow
67-
/** Benchmarking::plugin_name::function */ . The choice for the current
68-
tutorial would be /** Benchmarking::TimeBenchmarking::Timer */
67+
` /** Benchmarking::plugin_name::function */` . The choice for the current
68+
tutorial would be `/** Benchmarking::TimeBenchmarking::Timer */`
6969

7070

7171

72-
These answers provided us with the minimun necessary for the creation of plugin.
72+
These answers provide us with the minimum necessary for the creation of a plugin.
7373

74-
### Create a tfa - plugin
74+
## Create a TFA-Plugin
7575

76-
### Files tree structure
76+
### File tree structure
7777

78-
The final code shall be located in the folder path
79-
src_root_sb/tfa-plugin/TimeBenchmarking with the following structure:
78+
The final code shall be located in
79+
`src_root_sb/tfa-plugin/TimeBenchmarking` with the following structure:
8080

8181
TimeBenchmarking
8282
├── CMakeLists.txt
@@ -89,17 +89,17 @@ TimeBenchmarking
8989

9090
### Register a new plugin into the TFA core of the shadow builder
9191

92-
The shadow-builder is relying on tfa's plugins to be executed to answer the
93-
parser dispatch. Therefore the need of some interoperability is needed.
92+
The shadow-builder is relying on TFA's plugins to be executed to answer the
93+
parser dispatch. Therefore, the need of some interoperability is needed.
9494

9595
Every new plugins are written by implementing the IPlugin interface as shown in
96-
the file src_root/tfa_core/inc/tfa/IPlugin.h. All what the interface needs to do is to
96+
the file `src_root/tfa_core/inc/tfa/IPlugin.h`. All what the interface needs to do is to
9797
implement the pure virtual function. A simple example would be as in the
9898
plugin_test:
9999

100-
in the plugin header:
100+
In the plugin header:
101101

102-
``` cpp
102+
```cpp
103103
class TimeBenchmarking: public IPlugin {
104104
public:
105105
TimeBenchmarking();
@@ -116,9 +116,9 @@ extern "C" void destroy(IPlugin* p) {
116116
delete p;
117117
}
118118
```
119-
in the plugin source code:
119+
In the plugin source code:
120120
121-
``` cpp
121+
```cpp
122122
TimeBenchmarking::TimeBenchmarking() {}
123123
124124
TimeBenchmarking::~TimeBenchmarking()
@@ -141,7 +141,7 @@ Just as a reminder, the listener is an object derivated from the interface
141141
replace by a piece of code.
142142

143143
The declaration of the object shall be as display below:
144-
``` cpp
144+
```cpp
145145
class Timer: public ITFACommentListener
146146
{
147147
public:
@@ -152,11 +152,11 @@ public:
152152
```
153153

154154
As shown above, the class is inheriting from the ITFACommentListenner classe.
155-
the ITFACommentListener as one pure virtual method called runnableComments.
155+
The ITFACommentListener has one pure-virtual method called runnableComments.
156156
This means your plugin has to implement the method runnableComments(...).
157157

158158

159-
``` cpp
159+
```cpp
160160
Timer::Timer()
161161
:
162162
ITFACommentListener("Benchmarking::User::Timer")
@@ -170,7 +170,7 @@ Status Timer::runnableComments(const TFACommentInfo& cleanComment,
170170
}
171171
```
172172
173-
Now the functions are correclty implemented. The timer needs several things to
173+
Now, the functions are correctly implemented. The timer needs several things to
174174
measure the time spent in a function:
175175
176176
1. Start the timer before the function, get an intial timestamp
@@ -182,7 +182,7 @@ This basically means that the plugin will neeed a way to get the timestamps, as
182182
discussed before, by using the clock_gettime, and print it to the user by using
183183
printf.
184184
185-
A tag can be provided by several parameters. This will be usefull for the sack of
185+
A tag can be provided by several parameters. This will be useful for the sake of
186186
the timer:
187187
188188
* A parameter to identify what's is the timer's status (i.e. start or stop)
@@ -259,7 +259,7 @@ Status Timer::runnableComments(const TFACommentInfo& cleanComment,
259259
{
260260
const std::vector<std::string> params = comment.getParams();
261261
262-
if (params[0] == "declare" && params.size() == 1) {
262+
if (params.size() == 1 && params[0] == "declare") {
263263
replacement = "#include <time.h>\n";
264264
replacement += "#include <stdio.h>\n";
265265
return Status::returnStatusOkay();
@@ -453,7 +453,7 @@ It shall look like the following:
453453

454454
```cmake
455455
project(TimeBenchmarking VERSION 0.1 DESCRIPTION "MY Plugin")
456-
set(CMAKE_CXX_STANDARD 14) # Enable c++14 standard
456+
set(CMAKE_CXX_STANDARD 14)
457457
458458
set(PLUGIN_NAME "TimeBenchmarking")
459459
@@ -485,7 +485,7 @@ subdirectory of the plugin:
485485

486486
```cmake
487487
cmake_minimum_required(VERSION 3.10) # CMake version check
488-
set(CMAKE_CXX_STANDARD 14) # Enable c++14 standard
488+
set(CMAKE_CXX_STANDARD 14)
489489
490490
add_subdirectory(plugin_test)
491491
add_subdirectory(myplugin)
@@ -505,7 +505,7 @@ shadow-builder.
505505
### TFA configuration
506506

507507
An example fo the configuration file is in the source tree at
508-
src_root/res/tfa-res/tfa.xml
508+
`src_root/res/tfa-res/tfa.xml`.
509509

510510
This file only keeps track of the path where to look for plugins. Watch out! this
511511
file is a template and renewed at each compilation.

0 commit comments

Comments
 (0)