FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
llama.cpp/tests/test-log.cpp at master · allozaur/llama.cpp · GitHub
allozaur
/
llama.cpp
Public
forked from
ggml-org/llama.cpp
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
llama.cpp
/
tests
/
test-log.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (35 loc) · 1.27 KB
Breadcrumbs
llama.cpp
/
tests
/
test-log.cpp
Copy path
File metadata and controls
43 lines (35 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
include
"
log.h
"
#
include
<
cstdlib
>
#
include
<
thread
>
int
main
() {
const
int
n_thread =
8
;
std::thread threads[n_thread];
for
(
int
i =
0
; i < n_thread; i++) {
threads[i] =
std::thread
([i]() {
const
int
n_msg =
1000
;
for
(
int
j =
0
; j < n_msg; j++) {
const
int
log_type =
std::rand
() %
4
;
switch
(log_type) {
case
0
:
LOG_INF
(
"
Thread %d: %d
\n
"
, i, j);
break
;
case
1
:
LOG_WRN
(
"
Thread %d: %d
\n
"
, i, j);
break
;
case
2
:
LOG_ERR
(
"
Thread %d: %d
\n
"
, i, j);
break
;
case
3
:
LOG_DBG
(
"
Thread %d: %d
\n
"
, i, j);
break
;
default
:
break
;
}
if
(
rand
() %
10
<
5
) {
common_log_set_timestamps
(
common_log_main
(),
rand
() %
2
);
common_log_set_prefix
(
common_log_main
(),
rand
() %
2
);
}
}
});
}
for
(
int
i =
0
; i < n_thread; i++) {
threads[i].
join
();
}
common_log_flush
(
common_log_main
());
//
We explicitly free the logger singleton to avoid hanging on Windows
//
related to timing issues of thread startup and DLL teardown
common_log_free
(
common_log_main
());
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL