Blame include/freerdp/utils/profiler.h

Packit Service fa4841
/**
Packit Service fa4841
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit Service fa4841
 * Profiler Utils
Packit Service fa4841
 *
Packit Service fa4841
 * Copyright 2011 Stephen Erisman
Packit Service fa4841
 *
Packit Service fa4841
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit Service fa4841
 * you may not use this file except in compliance with the License.
Packit Service fa4841
 * You may obtain a copy of the License at
Packit Service fa4841
 *
Packit Service fa4841
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit Service fa4841
 *
Packit Service fa4841
 * Unless required by applicable law or agreed to in writing, software
Packit Service fa4841
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit Service fa4841
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit Service fa4841
 * See the License for the specific language governing permissions and
Packit Service fa4841
 * limitations under the License.
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
#ifndef FREERDP_UTILS_PROFILER_H
Packit Service fa4841
#define FREERDP_UTILS_PROFILER_H
Packit Service fa4841
Packit Service fa4841
#include <freerdp/api.h>
Packit Service fa4841
#include <freerdp/utils/stopwatch.h>
Packit Service fa4841
Packit Service fa4841
typedef struct _PROFILER PROFILER;
Packit Service fa4841
Packit Service fa4841
#ifdef __cplusplus
Packit Service fa4841
extern "C"
Packit Service fa4841
{
Packit Service fa4841
#endif
Packit Service fa4841
Packit Service fa4841
	FREERDP_API PROFILER* profiler_create(const char* name);
Packit Service fa4841
	FREERDP_API void profiler_free(PROFILER* profiler);
Packit Service fa4841
Packit Service fa4841
	FREERDP_API void profiler_enter(PROFILER* profiler);
Packit Service fa4841
	FREERDP_API void profiler_exit(PROFILER* profiler);
Packit Service fa4841
Packit Service fa4841
	FREERDP_API void profiler_print_header(void);
Packit Service fa4841
	FREERDP_API void profiler_print(PROFILER* profiler);
Packit Service fa4841
	FREERDP_API void profiler_print_footer(void);
Packit Service fa4841
Packit Service fa4841
#ifdef __cplusplus
Packit Service fa4841
}
Packit Service fa4841
#endif
Packit Service fa4841
Packit Service fa4841
#ifdef WITH_PROFILER
Packit Service fa4841
#define PROFILER_RENAME(prof, name)   \
Packit Service fa4841
	do                                \
Packit Service fa4841
	{                                 \
Packit Service fa4841
		profiler_free(prof);          \
Packit Service fa4841
		prof = profiler_create(name); \
Packit Service fa4841
	} while (0)
Packit Service fa4841
#define PROFILER_DEFINE(prof) PROFILER* prof;
Packit Service fa4841
#define PROFILER_CREATE(prof, name) prof = profiler_create(name);
Packit Service fa4841
#define PROFILER_FREE(prof) profiler_free(prof);
Packit Service fa4841
#define PROFILER_ENTER(prof) profiler_enter(prof);
Packit Service fa4841
#define PROFILER_EXIT(prof) profiler_exit(prof);
Packit Service fa4841
#define PROFILER_PRINT_HEADER profiler_print_header();
Packit Service fa4841
#define PROFILER_PRINT(prof) profiler_print(prof);
Packit Service fa4841
#define PROFILER_PRINT_FOOTER profiler_print_footer();
Packit Service fa4841
#else
Packit Service fa4841
#define PROFILER_RENAME(prof, name) \
Packit Service fa4841
	do                              \
Packit Service fa4841
	{                               \
Packit Service fa4841
	} while (0)
Packit Service fa4841
Packit Service fa4841
#define PROFILER_DEFINE(prof)
Packit Service fa4841
#define PROFILER_CREATE(prof, name) \
Packit Service fa4841
	do                              \
Packit Service fa4841
	{                               \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_FREE(prof) \
Packit Service fa4841
	do                      \
Packit Service fa4841
	{                       \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_ENTER(prof) \
Packit Service fa4841
	do                       \
Packit Service fa4841
	{                        \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_EXIT(prof) \
Packit Service fa4841
	do                      \
Packit Service fa4841
	{                       \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_PRINT_HEADER \
Packit Service fa4841
	do                        \
Packit Service fa4841
	{                         \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_PRINT(prof) \
Packit Service fa4841
	do                       \
Packit Service fa4841
	{                        \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#define PROFILER_PRINT_FOOTER \
Packit Service fa4841
	do                        \
Packit Service fa4841
	{                         \
Packit Service fa4841
	} while (0);
Packit Service fa4841
#endif
Packit Service fa4841
Packit Service fa4841
#endif /* FREERDP_UTILS_PROFILER_H */