Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] create a complete document #571

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add time api doc
  • Loading branch information
Cyberhan123 committed Oct 17, 2023
commit f6e0be41b0d5191102f689341f52c71ac8d1e30c
5 changes: 0 additions & 5 deletions docs/reference/api-examples.md

This file was deleted.

80 changes: 80 additions & 0 deletions docs/reference/time-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
outline: deep
---

# ggml time api

## ggml init time {#initTime}

ggml init instance prepare for other time api.

- **type**

```c++
GGML_API void ggml_time_init(void);
```

- **detail**

Call this once at the beginning of the program

- **example**

```c++

#include "ggml/ggml.h"

void main(){
ggml_time_init();
//...
}
```
## ggml_time_ms {#timeMillisecond}

Get time in millisecond.

- **type**

```c++
GGML_API int64_t ggml_time_ms(void);
```

- **example**

```c++

#include "ggml/ggml.h"

void main(){
ggml_time_init();
const auto t_main_start_ms = ggml_time_ms();
//...
const auto t_main_end_ms = ggml_time_ms();
const total = t_main_end_ms-t_main_start_ms;
}
```

## ggml_time_us {#timeMicroseconds}

Get time in microseconds.

- **type**

```c++
GGML_API int64_t ggml_time_us(void);
```

- **example**

```c++
#include "ggml/ggml.h"

void main(){
ggml_time_init();
const auto t_main_start_us = ggml_time_us();
//...
const auto t_main_end_us = ggml_time_us();
const total = t_main_end_us-t_main_start_us;
}
```