NUGU SDK Linux  1.7.6
nugu_prof.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_PROF_H__
18 #define __NUGU_PROF_H__
19 
20 #include <nugu.h>
21 #include <base/nugu_uuid.h>
22 #include <glib.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
196 };
197 
203  enum nugu_prof_type type;
204  char dialog_id[NUGU_MAX_UUID_STRING_SIZE + 1]; /* dialog request id */
205  char msg_id[NUGU_MAX_UUID_STRING_SIZE + 1]; /* message id */
206  gint64 timestamp; /* timestamp(microseconds) */
207  char *contents; /* additional contents */
208 };
209 
214 typedef void (*NuguProfCallback)(enum nugu_prof_type type,
215  const struct nugu_prof_data *data,
216  void *userdata);
217 
221 NUGU_API void nugu_prof_clear(void);
222 
226 NUGU_API void nugu_prof_enable_tracelog(void);
227 
231 NUGU_API void nugu_prof_disable_tracelog(void);
232 
238 NUGU_API void nugu_prof_set_callback(NuguProfCallback callback, void *userdata);
239 
247 NUGU_API int nugu_prof_mark(enum nugu_prof_type type);
248 
260  const char *dialog_id, const char *msg_id,
261  const char *contents);
262 
268 NUGU_API struct nugu_prof_data *
270 
277 NUGU_API int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1,
278  const struct timespec *ts2);
279 
287  enum nugu_prof_type type2);
288 
295 NUGU_API int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1,
296  const struct nugu_prof_data *prof2);
297 
303 NUGU_API const char *nugu_prof_get_type_name(enum nugu_prof_type type);
304 
310 NUGU_API void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to);
311 
316 #ifdef __cplusplus
317 }
318 #endif
319 
320 #endif
NUGU_API void nugu_prof_set_callback(NuguProfCallback callback, void *userdata)
Set profiling callback.
nugu_prof_type
Profiling type list.
Definition: nugu_prof.h:46
NUGU_API struct nugu_prof_data * nugu_prof_get_last_data(enum nugu_prof_type type)
Get last cached data by profiling type.
NUGU_API void nugu_prof_enable_tracelog(void)
turn on the profiling trace log message
NUGU_API void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to)
Dump the profiling data between 'from' type to 'to' type.
void(* NuguProfCallback)(enum nugu_prof_type type, const struct nugu_prof_data *data, void *userdata)
Callback prototype for receiving an attachment.
Definition: nugu_prof.h:214
NUGU_API const char * nugu_prof_get_type_name(enum nugu_prof_type type)
Get string type name for profiling type.
NUGU_API int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, const struct timespec *ts2)
Get the time difference(ts2 - ts1) value in milliseconds.
NUGU_API int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, enum nugu_prof_type type2)
Get the time difference(ts2 - ts1) value in milliseconds.
NUGU_API int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, const struct nugu_prof_data *prof2)
Get the time difference(prof2 - prof1) value in milliseconds.
NUGU_API void nugu_prof_disable_tracelog(void)
turn off the profiling trace log message
NUGU_API int nugu_prof_mark(enum nugu_prof_type type)
Marking to profiling data and emit the callback.
NUGU_API int nugu_prof_mark_data(enum nugu_prof_type type, const char *dialog_id, const char *msg_id, const char *contents)
Marking to profiling data with additional id and emit the callback.
NUGU_API void nugu_prof_clear(void)
clear all cached profiling data
@ NUGU_PROF_TYPE_NETWORK_DNS_FAILED
Definition: nugu_prof.h:86
@ NUGU_PROF_TYPE_ASR_LAST_ATTACHMENT
Definition: nugu_prof.h:152
@ NUGU_PROF_TYPE_NETWORK_INTERNAL_ERROR
Definition: nugu_prof.h:95
@ NUGU_PROF_TYPE_SDK_PLUGIN_INIT_DONE
Definition: nugu_prof.h:53
@ NUGU_PROF_TYPE_TTS_STOPPED
Definition: nugu_prof.h:182
@ NUGU_PROF_TYPE_NETWORK_SSL_FAILED
Definition: nugu_prof.h:89
@ NUGU_PROF_TYPE_ASR_LISTENING_STARTED
Definition: nugu_prof.h:134
@ NUGU_PROF_TYPE_NETWORK_PING_REQUEST
Definition: nugu_prof.h:101
@ NUGU_PROF_TYPE_NETWORK_EVENT_FAILED
Definition: nugu_prof.h:116
@ NUGU_PROF_TYPE_NETWORK_PING_RESPONSE
Definition: nugu_prof.h:104
@ NUGU_PROF_TYPE_NETWORK_SERVER_ESTABLISH_RESPONSE
Definition: nugu_prof.h:74
@ NUGU_PROF_TYPE_ASR_RECOGNIZING_STARTED
Definition: nugu_prof.h:140
@ NUGU_PROF_TYPE_TTS_LAST_ATTACHMENT
Definition: nugu_prof.h:179
@ NUGU_PROF_TYPE_NETWORK_DIRECTIVES_CLOSED
Definition: nugu_prof.h:83
@ NUGU_PROF_TYPE_NETWORK_REGISTRY_RESPONSE
Definition: nugu_prof.h:65
@ NUGU_PROF_TYPE_TTS_SPEAK_DIRECTIVE
Definition: nugu_prof.h:158
@ NUGU_PROF_TYPE_ASR_RESULT
Definition: nugu_prof.h:155
@ NUGU_PROF_TYPE_NETWORK_EVENT_ATTACHMENT_REQUEST
Definition: nugu_prof.h:119
@ NUGU_PROF_TYPE_TTS_STARTED
Definition: nugu_prof.h:164
@ NUGU_PROF_TYPE_NETWORK_EVENT_RESPONSE
Definition: nugu_prof.h:113
@ NUGU_PROF_TYPE_TTS_FIRST_PCM_WRITE
Definition: nugu_prof.h:176
@ NUGU_PROF_TYPE_ASR_FIRST_ATTACHMENT
Definition: nugu_prof.h:149
@ NUGU_PROF_TYPE_NETWORK_EVENT_DIRECTIVE_RESPONSE
Definition: nugu_prof.h:122
@ NUGU_PROF_TYPE_NETWORK_CONNECTED
Definition: nugu_prof.h:80
@ NUGU_PROF_TYPE_NETWORK_CONNECT_REQUEST
Definition: nugu_prof.h:59
@ NUGU_PROF_TYPE_NETWORK_INVALID_TOKEN
Definition: nugu_prof.h:98
@ NUGU_PROF_TYPE_NETWORK_REGISTRY_FAILED
Definition: nugu_prof.h:68
@ NUGU_PROF_TYPE_NETWORK_SERVER_ESTABLISH_FAILED
Definition: nugu_prof.h:77
@ NUGU_PROF_TYPE_LAST_SERVER_INITIATIVE_DATA
Definition: nugu_prof.h:128
@ NUGU_PROF_TYPE_TTS_FINISHED
Definition: nugu_prof.h:185
@ NUGU_PROF_TYPE_AUDIO_FINISHED
Definition: nugu_prof.h:191
@ NUGU_PROF_TYPE_TTS_FIRST_ATTACHMENT
Definition: nugu_prof.h:170
@ NUGU_PROF_TYPE_ASR_RECOGNIZE
Definition: nugu_prof.h:137
@ NUGU_PROF_TYPE_NETWORK_REGISTRY_REQUEST
Definition: nugu_prof.h:62
@ NUGU_PROF_TYPE_ASR_END_POINT_DETECTED
Definition: nugu_prof.h:143
@ NUGU_PROF_TYPE_SDK_CREATED
Definition: nugu_prof.h:47
@ NUGU_PROF_TYPE_NETWORK_SERVER_ESTABLISH_REQUEST
Definition: nugu_prof.h:71
@ NUGU_PROF_TYPE_AUDIO_STARTED
Definition: nugu_prof.h:188
@ NUGU_PROF_TYPE_SDK_INIT_DONE
Definition: nugu_prof.h:56
@ NUGU_PROF_TYPE_MAX
Definition: nugu_prof.h:194
@ NUGU_PROF_TYPE_TTS_FIRST_DECODING
Definition: nugu_prof.h:173
@ NUGU_PROF_TYPE_ASR_TIMEOUT
Definition: nugu_prof.h:146
@ NUGU_PROF_TYPE_SDK_PLUGIN_INIT_START
Definition: nugu_prof.h:50
@ NUGU_PROF_TYPE_NETWORK_PING_FAILED
Definition: nugu_prof.h:107
@ NUGU_PROF_TYPE_TTS_NET_FIRST_ATTACHMENT
Definition: nugu_prof.h:167
@ NUGU_PROF_TYPE_NETWORK_EVENT_REQUEST
Definition: nugu_prof.h:110
@ NUGU_PROF_TYPE_TTS_FAILED
Definition: nugu_prof.h:161
@ NUGU_PROF_TYPE_WAKEUP_KEYWORD_DETECTED
Definition: nugu_prof.h:131
@ NUGU_PROF_TYPE_NETWORK_TIMEOUT
Definition: nugu_prof.h:92
@ NUGU_PROF_TYPE_NETWORK_EVENT_DIRECTIVE_TIMEOUT
Definition: nugu_prof.h:125
#define NUGU_MAX_UUID_STRING_SIZE
Maximum base16 encoded UUID string size.
Definition: nugu_uuid.h:57
Profiling raw data.
Definition: nugu_prof.h:202
enum nugu_prof_type type
Definition: nugu_prof.h:203