Freeciv21
Develop your civilization from humble roots to a global empire
timing.cpp File Reference
#include "timing.h"
#include <QElapsedTimer>
#include "log.h"
+ Include dependency graph for timing.cpp:

Go to the source code of this file.

Classes

class  civtimer
 

Enumerations

enum  timer_state { TIMER_STARTED , TIMER_STOPPED }
 

Functions

civtimertimer_new (enum timer_timetype type, enum timer_use use)
 Allocate a new timer with specified "type" and "use". More...
 
civtimertimer_renew (civtimer *t, enum timer_timetype type, enum timer_use use)
 Allocate a new timer, or reuse t, with specified "type" and "use". More...
 
void timer_destroy (civtimer *t)
 Deletes timer. More...
 
bool timer_in_use (civtimer *t)
 Return whether timer is in use. More...
 
void timer_clear (civtimer *t)
 Reset accumulated time to zero, and stop timer if going. More...
 
void timer_start (civtimer *t)
 Start timing, adding to previous accumulated time if timer has not been cleared. More...
 
void timer_stop (civtimer *t)
 Stop timing, and accumulate time so far. More...
 
double timer_read_seconds (civtimer *t)
 Read value from timer. More...
 

Enumeration Type Documentation

◆ timer_state

Enumerator
TIMER_STARTED 
TIMER_STOPPED 

Definition at line 22 of file timing.cpp.

Function Documentation

◆ timer_clear()

void timer_clear ( civtimer t)

Reset accumulated time to zero, and stop timer if going.

That is, this may be called whether t is started or stopped; in either case the timer is in the stopped state after this function.

Definition at line 83 of file timing.cpp.

Referenced by freeciv::server::end_phase(), freeciv::server::end_turn(), send_server_info_to_metaserver(), timer_renew(), and timing_log_real().

◆ timer_destroy()

◆ timer_in_use()

bool timer_in_use ( civtimer t)

Return whether timer is in use.

t may be nullptr, in which case returns 0

Definition at line 76 of file timing.cpp.

Referenced by auto_settlers_player().

◆ timer_new()

civtimer* timer_new ( enum timer_timetype  type,
enum timer_use  use 
)

◆ timer_read_seconds()

double timer_read_seconds ( civtimer t)

◆ timer_renew()

civtimer* timer_renew ( civtimer t,
enum timer_timetype  type,
enum timer_use  use 
)

Allocate a new timer, or reuse t, with specified "type" and "use".

Definition at line 51 of file timing.cpp.

Referenced by auto_settlers_player(), autosaves_callback(), begin_phase(), freeciv::server::end_phase(), incoming_client_packets(), freeciv::server::pulse(), signal_handler(), srv_ready(), timer_new(), and write_socket_data().

◆ timer_start()

◆ timer_stop()

void timer_stop ( civtimer t)

Stop timing, and accumulate time so far.

(The current time is stored in t->start, so that timer_read_seconds can call this to take a point reading if the timer is active.) A warning is printed if the timer is already stopped.

Definition at line 116 of file timing.cpp.

Referenced by autosaves_callback(), dai_manage_taxes(), end_search(), savegame3_save(), savegame_load(), timer_read_seconds(), and timing_log_real().