aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/transaction.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-25 09:25:51 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-25 09:25:51 +1000
commitc371ff3de8abbaf3428eadb905d7f940281196c1 (patch)
tree51725b80fb4275ea2f11c41bd771566fd1629f5f /sway/desktop/transaction.c
parentImplement transaction timings debug (diff)
downloadsway-c371ff3de8abbaf3428eadb905d7f940281196c1.tar.gz
sway-c371ff3de8abbaf3428eadb905d7f940281196c1.tar.zst
sway-c371ff3de8abbaf3428eadb905d7f940281196c1.zip
Implement per-configure debug timings
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r--sway/desktop/transaction.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index cb23ab69..31a9bf57 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -32,6 +32,7 @@ struct sway_transaction {
32 list_t *instructions; // struct sway_transaction_instruction * 32 list_t *instructions; // struct sway_transaction_instruction *
33 list_t *damage; // struct wlr_box * 33 list_t *damage; // struct wlr_box *
34 size_t num_waiting; 34 size_t num_waiting;
35 size_t num_configures;
35 struct sway_transaction *next; 36 struct sway_transaction *next;
36 struct timespec create_time; 37 struct timespec create_time;
37 struct timespec commit_time; 38 struct timespec commit_time;
@@ -291,6 +292,7 @@ void transaction_commit(struct sway_transaction *transaction) {
291 } 292 }
292 list_add(con->instructions, instruction); 293 list_add(con->instructions, instruction);
293 } 294 }
295 transaction->num_configures = transaction->num_waiting;
294 if (server.debug_txn_timings) { 296 if (server.debug_txn_timings) {
295 clock_gettime(CLOCK_MONOTONIC, &transaction->commit_time); 297 clock_gettime(CLOCK_MONOTONIC, &transaction->commit_time);
296 } 298 }
@@ -331,10 +333,24 @@ void transaction_commit(struct sway_transaction *transaction) {
331static void set_instruction_ready( 333static void set_instruction_ready(
332 struct sway_transaction_instruction *instruction) { 334 struct sway_transaction_instruction *instruction) {
333 instruction->ready = true; 335 instruction->ready = true;
336 struct sway_transaction *transaction = instruction->transaction;
337
338 if (server.debug_txn_timings) {
339 struct timespec now;
340 clock_gettime(CLOCK_MONOTONIC, &now);
341 struct timespec *start = &transaction->commit_time;
342 float ms = (now.tv_sec - start->tv_sec) * 1000 +
343 (now.tv_nsec - start->tv_nsec) / 1000000.0;
344 wlr_log(L_DEBUG, "Transaction %p: %li/%li ready in %.1fms (%s)",
345 transaction,
346 transaction->num_configures - transaction->num_waiting + 1,
347 transaction->num_configures, ms,
348 instruction->container->name);
349
350 }
334 351
335 // If all views are ready, apply the transaction. 352 // If all views are ready, apply the transaction.
336 // If the transaction has timed out then its num_waiting will be 0 already. 353 // If the transaction has timed out then its num_waiting will be 0 already.
337 struct sway_transaction *transaction = instruction->transaction;
338 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) { 354 if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
339#if !TRANSACTION_DEBUG 355#if !TRANSACTION_DEBUG
340 wlr_log(L_DEBUG, "Transaction %p is ready", transaction); 356 wlr_log(L_DEBUG, "Transaction %p is ready", transaction);