|
@@ -143,8 +143,6 @@ syscall
|
143
|
143
|
cmp rax, 0
|
144
|
144
|
jne fault
|
145
|
145
|
|
146
|
|
-; initializing lapptr
|
147
|
|
-
|
148
|
146
|
; preparing SIGINT catch
|
149
|
147
|
mov rax, proc_lap_handler
|
150
|
148
|
mov qword [sigaction.sa_handler], rax
|
|
@@ -267,30 +265,25 @@ newline_exit:
|
267
|
265
|
;
|
268
|
266
|
proc_print_time:
|
269
|
267
|
|
270
|
|
- ; updating ts_cur time
|
271
|
268
|
mov rax, 228 ; clock_gettime
|
272
|
269
|
mov rdi, 0 ; CLOCK_REALTIME
|
273
|
270
|
mov rsi, ts_cur
|
274
|
|
- syscall
|
|
271
|
+ syscall ; updating ts_cur time
|
275
|
272
|
|
276
|
|
- ; Calculating elapsed ns
|
277
|
273
|
mov rax, [ts_cur.tv_nsec]
|
278
|
274
|
sub rax, [ts_start.tv_nsec]
|
279
|
|
- cmp rax, 0
|
|
275
|
+ cmp rax, 0 ; Calculating elapsed ns
|
280
|
276
|
jge print_time_us_cont
|
281
|
|
- ; negativ result
|
282
|
|
- add rax, 1000000000
|
|
277
|
+ add rax, 1000000000 ; negativ result
|
283
|
278
|
sub qword [ts_cur.tv_sec], 1
|
284
|
|
-
|
285
|
279
|
print_time_us_cont:
|
286
|
|
- ; Divide result given time_res
|
287
|
|
- xor rdx, rdx
|
288
|
|
- div qword [ts_sleep.tv_nsec]
|
289
|
280
|
|
290
|
|
- ; set the nsec char in timestr
|
|
281
|
+ ; set the nanosec chars (time_res chars) in timestr
|
|
282
|
+ xor rdx, rdx
|
|
283
|
+ div qword [ts_sleep.tv_nsec] ; Divide result given time_res
|
291
|
284
|
mov rdi, timestr + 6
|
292
|
|
- mov rsi, rdi
|
293
|
|
- add rdi, [time_res] ; r8 points on last char before \r
|
|
285
|
+ mov rsi, rdi ; rsi points on 1st nanosec digit
|
|
286
|
+ add rdi, [time_res] ; rdi points on last nanosec digit
|
294
|
287
|
mov r8, 10
|
295
|
288
|
print_time_us_loop:
|
296
|
289
|
xor rdx, rdx
|
|
@@ -302,33 +295,30 @@ proc_print_time:
|
302
|
295
|
cmp rsi, rdi
|
303
|
296
|
loopne print_time_us_loop
|
304
|
297
|
|
305
|
|
- ; handling seconds, minutes & hours
|
|
298
|
+ ; filling timestr with seconds & minutes chars
|
306
|
299
|
mov rax, [ts_cur.tv_sec]
|
307
|
|
- sub rax, [ts_start.tv_sec]
|
308
|
|
- ; rax now contain elapsed seconds
|
309
|
|
- ; filling timestr with seconds & minutes
|
|
300
|
+ sub rax, [ts_start.tv_sec] ; rax now contain elapsed seconds
|
|
301
|
+
|
|
302
|
+ mov r8, 10
|
|
303
|
+ mov r9, 6
|
310
|
304
|
|
311
|
305
|
xor rdx, rdx
|
312
|
|
- mov rcx, 10
|
313
|
|
- div rcx
|
|
306
|
+ div r8
|
314
|
307
|
add dl, 0x30
|
315
|
308
|
mov byte [timestr + 5], dl
|
316
|
309
|
|
317
|
310
|
xor dl, dl
|
318
|
|
- mov rcx, 6
|
319
|
|
- div rcx
|
|
311
|
+ div r9
|
320
|
312
|
add dl, 0x30
|
321
|
313
|
mov byte [timestr + 4], dl
|
322
|
314
|
|
323
|
315
|
xor dl, dl
|
324
|
|
- mov rcx, 10
|
325
|
|
- div rcx
|
|
316
|
+ div r8
|
326
|
317
|
add dl, 0x30
|
327
|
318
|
mov byte [timestr + 2], dl
|
328
|
319
|
|
329
|
320
|
xor dl, dl
|
330
|
|
- mov rcx, 6
|
331
|
|
- div rcx
|
|
321
|
+ div r9
|
332
|
322
|
add dl, 0x30
|
333
|
323
|
mov byte[timestr + 1], dl
|
334
|
324
|
|