external/htable.c
SHL_RING = \
src/shl_ring.h
+SHL_TIMER = \
+ src/shl_timer.h
#
# libeloop
$(SHL_ARRAY) \
$(SHL_HASHTABLE) \
$(SHL_RING) \
+ $(SHL_TIMER) \
src/main.h \
src/conf.c src/conf.h \
src/ui.c src/ui.h \
libkmscon_static_la_SOURCES = \
src/static_llog.h \
- src/static_hook.h \
- src/static_misc.h \
- src/static_misc.c
+ src/static_hook.h
nodist_libkmscon_static_la_SOURCES =
libkmscon_static_la_CPPFLAGS = \
#include "console.h"
#include "log.h"
#include "main.h"
-#include "static_misc.h"
+#include "shl_timer.h"
#include "unicode.h"
#define LOG_SUBSYSTEM "console"
struct kmscon_console {
size_t ref;
unsigned int flags;
- struct kmscon_timer *timer;
+ struct shl_timer *timer;
/* default attributes for new cells */
struct kmscon_console_attr def_attr;
con->def_attr.fg = 255;
con->def_attr.fb = 255;
- ret = kmscon_timer_new(&con->timer);
+ ret = shl_timer_new(&con->timer);
if (ret)
goto err_free;
return 0;
err_timer:
- kmscon_timer_free(con->timer);
+ shl_timer_free(con->timer);
for (i = 0; i < con->line_num; ++i)
line_free(con->lines[i]);
free(con->lines);
line_free(con->lines[i]);
free(con->lines);
free(con->tab_ruler);
- kmscon_timer_free(con->timer);
+ shl_timer_free(con->timer);
free(con);
}
if (prepare_cb) {
if (kmscon_conf.render_timing)
- kmscon_timer_reset(con->timer);
+ shl_timer_reset(con->timer);
ret = prepare_cb(con, data);
if (ret) {
}
if (kmscon_conf.render_timing)
- time_prep = kmscon_timer_elapsed(con->timer);
+ time_prep = shl_timer_elapsed(con->timer);
} else {
time_prep = 0;
}
/* push each character into rendering pipeline */
if (kmscon_conf.render_timing)
- kmscon_timer_reset(con->timer);
+ shl_timer_reset(con->timer);
iter = con->sb_pos;
k = 0;
}
if (kmscon_conf.render_timing)
- time_draw = kmscon_timer_elapsed(con->timer);
+ time_draw = shl_timer_elapsed(con->timer);
/* perform final rendering steps */
if (render_cb) {
if (kmscon_conf.render_timing)
- kmscon_timer_reset(con->timer);
+ shl_timer_reset(con->timer);
ret = render_cb(con, data);
if (ret)
log_warning("cannot render via text-renderer");
if (kmscon_conf.render_timing)
- time_rend = kmscon_timer_elapsed(con->timer);
+ time_rend = shl_timer_elapsed(con->timer);
} else {
time_rend = 0;
}
#include "log.h"
#include "main.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "text.h"
#include "ui.h"
#include "uterm.h"
/*
- * kmscon - Miscellaneous Helpers
+ * shl - Timers
*
* Copyright (c) 2011-2012 David Herrmann <dh.herrmann@googlemail.com>
* Copyright (c) 2011 University of Tuebingen
*/
/*
- * Miscellaneous Helpers
- * Rings: Rings are used to buffer a byte-stream of data. It works like a FIFO
- * queue but in-memory.
+ * Timers
*/
+#ifndef SHL_TIMER_H
+#define SHL_TIMER_H
+
#include <errno.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
-#include <string.h>
#include <time.h>
-#include "htable.h"
-#include "static_misc.h"
-struct kmscon_timer {
+struct shl_timer {
struct timespec start;
uint64_t elapsed;
};
-int kmscon_timer_new(struct kmscon_timer **out)
+static inline void shl_timer_reset(struct shl_timer *timer)
+{
+ if (!timer)
+ return;
+
+ clock_gettime(CLOCK_MONOTONIC, &timer->start);
+ timer->elapsed = 0;
+}
+
+static inline int shl_timer_new(struct shl_timer **out)
{
- struct kmscon_timer *timer;
+ struct shl_timer *timer;
if (!out)
return -EINVAL;
if (!timer)
return -ENOMEM;
memset(timer, 0, sizeof(*timer));
- kmscon_timer_reset(timer);
+ shl_timer_reset(timer);
*out = timer;
return 0;
}
-void kmscon_timer_free(struct kmscon_timer *timer)
+static inline void shl_timer_free(struct shl_timer *timer)
{
if (!timer)
return;
free(timer);
}
-void kmscon_timer_reset(struct kmscon_timer *timer)
+static inline void shl_timer_start(struct shl_timer *timer)
{
if (!timer)
return;
clock_gettime(CLOCK_MONOTONIC, &timer->start);
- timer->elapsed = 0;
}
-void kmscon_timer_start(struct kmscon_timer *timer)
-{
- if (!timer)
- return;
-
- clock_gettime(CLOCK_MONOTONIC, &timer->start);
-}
-
-uint64_t kmscon_timer_stop(struct kmscon_timer *timer)
+static inline uint64_t shl_timer_stop(struct shl_timer *timer)
{
struct timespec spec;
int64_t off, nsec;
return timer->elapsed;
}
-uint64_t kmscon_timer_elapsed(struct kmscon_timer *timer)
+static inline uint64_t shl_timer_elapsed(struct shl_timer *timer)
{
struct timespec spec;
int64_t off, nsec;
return timer->elapsed + off;
}
+
+#endif /* SHL_TIMER_H */
+++ /dev/null
-/*
- * kmscon - Miscellaneous Helpers
- *
- * Copyright (c) 2011-2012 David Herrmann <dh.herrmann@googlemail.com>
- * Copyright (c) 2011 University of Tuebingen
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Miscellaneous Helpers
- * This provides several helper objects like memory-rings or similar.
- */
-
-#ifndef KMSCON_MISC_H
-#define KMSCON_MISC_H
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "static_hook.h"
-
-/* time measurement */
-
-struct kmscon_timer;
-
-int kmscon_timer_new(struct kmscon_timer **out);
-void kmscon_timer_free(struct kmscon_timer *timer);
-
-void kmscon_timer_reset(struct kmscon_timer *timer);
-void kmscon_timer_start(struct kmscon_timer *timer);
-uint64_t kmscon_timer_stop(struct kmscon_timer *timer);
-uint64_t kmscon_timer_elapsed(struct kmscon_timer *timer);
-
-#endif /* KMSCON_MISC_H */
#include "main.h"
#include "pty.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "terminal.h"
#include "text.h"
#include "unicode.h"
#include <string.h>
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "text.h"
#include "uterm.h"
#include <stdlib.h>
#include <string.h>
#include "log.h"
-#include "static_misc.h"
#include "text.h"
#include "unicode.h"
#include "uterm.h"
#include <stdlib.h>
#include <string.h>
#include "log.h"
-#include "static_misc.h"
#include "text.h"
#include "unicode.h"
#include "uterm.h"
#include <string.h>
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "text.h"
#include "uterm.h"
#include "log.h"
#include "shl_dlist.h"
#include "shl_hashtable.h"
-#include "static_misc.h"
#include "text.h"
#include "unicode.h"
#include "uterm.h"
#include "log.h"
#include "shl_dlist.h"
#include "shl_hashtable.h"
-#include "static_misc.h"
#include "text.h"
#include "unicode.h"
#include "uterm.h"
#include "shl_dlist.h"
#include "shl_hashtable.h"
#include "static_gl.h"
-#include "static_misc.h"
#include "text.h"
#include "unicode.h"
#include "uterm.h"
#include "eloop.h"
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "terminal.h"
#include "ui.h"
#include "uterm.h"
#include "log.h"
#include "shl_array.h"
#include "shl_hashtable.h"
-#include "static_misc.h"
#include "unicode.h"
#define LOG_SUBSYSTEM "unicode"
#include "eloop.h"
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
+#include "static_hook.h"
#include "uterm.h"
#include "uterm_input.h"
#include <stdbool.h>
#include <stdlib.h>
#include "eloop.h"
-#include "static_misc.h"
#include "uterm.h"
struct kbd_desc;
#include <string.h>
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "uterm.h"
#ifdef UTERM_HAVE_SYSTEMD
#include <unistd.h>
#include "eloop.h"
#include "log.h"
-#include "static_misc.h"
+#include "static_hook.h"
#include "uterm.h"
#include "uterm_video.h"
#include <stdbool.h>
#include <stdlib.h>
#include "eloop.h"
-#include "static_misc.h"
+#include "static_hook.h"
#include "uterm.h"
/* backend-operations */
#include <xf86drmMode.h>
#include "eloop.h"
#include "log.h"
-#include "static_misc.h"
#include "uterm.h"
#include "uterm_video.h"
#include <xf86drmMode.h>
#include "eloop.h"
#include "log.h"
-#include "static_misc.h"
#include "uterm.h"
#include "uterm_video.h"
#include <sys/mman.h>
#include <unistd.h>
#include "log.h"
-#include "static_misc.h"
#include "uterm.h"
#include "uterm_video.h"
#include "eloop.h"
#include "log.h"
#include "shl_dlist.h"
-#include "static_misc.h"
#include "uterm.h"
#define LOG_SUBSYSTEM "vt"