ijksdl_timer.h 1.6 KB
Newer Older
Z
Zhang Rui 已提交
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
/*****************************************************************************
 * ijksdl_thread.h
 *****************************************************************************
 *
 * copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
 *
 * This file is part of ijkPlayer.
 *
 * ijkPlayer is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * ijkPlayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with ijkPlayer; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef IJKSDL__IJKSDL_TIMER_H
#define IJKSDL__IJKSDL_TIMER_H

#include "ijksdl_stdinc.h"

void SDL_Delay(Uint32 ms);

Z
Zhang Rui 已提交
31 32
Uint64 SDL_GetTickHR(void);

Z
Zhang Rui 已提交
33 34 35 36

typedef struct SDL_Profiler {
    int64_t total_elapsed;
    int     total_counter;
Z
Zhang Rui 已提交
37 38 39 40

    int64_t sample_elapsed;
    int     sample_counter;
    float   sample_per_seconds;
Z
Zhang Rui 已提交
41
    int64_t average_elapsed;
Z
Zhang Rui 已提交
42

Z
Zhang Rui 已提交
43 44 45 46 47 48 49 50 51
    int64_t begin_time;

    int     max_sample;
} SDL_Profiler;

void    SDL_ProfilerReset(SDL_Profiler* profiler, int max_sample);
void    SDL_ProfilerBegin(SDL_Profiler* profiler);
int64_t SDL_ProfilerEnd(SDL_Profiler* profiler);

Z
Zhang Rui 已提交
52
#endif