Skip to content

Commit

Permalink
chore(docs): update func and span docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Water-Melon committed Feb 2, 2024
1 parent b8f1083 commit 222d93d
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/book/cn/func.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@



### 视频介绍

<iframe src="//player.bilibili.com/player.html?bvid=BV1vT4y1t7ha&page=1&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" height="480px" width="100%"> </iframe>



### 头文件

```c
Expand Down
54 changes: 54 additions & 0 deletions docs/book/cn/span.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Melon中的资源开销(span)组件是用来测量C语言函数开销的,



### 视频介绍

<iframe src="//player.bilibili.com/player.html?bvid=BV1jZ4y1E7H9&page=1&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" height="480px" width="100%"> </iframe>



### 头文件

```c
Expand Down Expand Up @@ -131,6 +137,54 @@ void mln_span_free(mln_span_t *s);
#### mln_span_file
```c
mln_span_file(s);
```
描述:获取指定span所在文件的文件名。
返回值:`char *`文件名指针
#### mln_span_func
```c
mln_span_func(s);
```
描述:获取指定span所针对的函数名。
返回值:`char *`函数名指针
#### mln_span_line
```c
mln_span_line(s);
```
描述:获取指定span所针对的文件行数。
返回值:`int`类型文件行数
#### mln_span_time_cost
```c
mln_span_time_cost(s);
```
描述:获取指定span所测量的耗时时长,以微秒为单位。
返回值:`mln_u64_t`微秒数
### 示例
这是一个多线程的示例,用来展示`mln_span`接口的使用以及在多线程环境下的效果。
Expand Down
48 changes: 48 additions & 0 deletions docs/book/en/span.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,54 @@ Return value: None
#### mln_span_file
```c
mln_span_file(s);
```
Description: Get the filename of the specified span's location.
Return value: `char *` pointer to the filename.
#### mln_span_func
```c
mln_span_func(s);
```
Description: Get the function name referred to by the specified span.
Return value: `char *` pointer to the function name.
#### mln_span_line
```c
mln_span_line(s);
```
Description: Get the line number of the file referred to by the specified span.
Return value: `int` representing the line number.
#### mln_span_time_cost
```c
mln_span_time_cost(s);
```
Description: Get the duration of the measurement taken by the specified span, in microseconds.
Return value: `mln_u64_t` representing the duration in microseconds.
### Example
This is a multi-threading example demonstrating the usage of the `mln_span` interfaces and its runtime behavior in a multi-threaded environment.
Expand Down

0 comments on commit 222d93d

Please sign in to comment.