Skip to content

Commit b3ffc01

Browse files
author
Alexander Zhdanov
committed
Merge branch 'master' into port2firebird_tablespaces2
2 parents 362ee8d + 01c64fe commit b3ffc01

File tree

13 files changed

+520
-21
lines changed

13 files changed

+520
-21
lines changed

doc/README.isql_enhancements.txt

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,129 @@ SQL> SET PER_TAB OFF;
327327

328328

329329

330+
12) SET WIRE_STATS option.
331+
332+
Author: Vladyslav Khorsun <hvlad at users sourceforge net>
333+
334+
When set to ON shows wire (network) statistics after query execution.
335+
It is set to OFF by default. The name WIRE_STATS could be shortened up to WIRE.
336+
337+
The statistics counters shown in two groups: 'logical' and 'physical':
338+
- logical counters show numbers of packets in terms of Firebird wire protocol
339+
and number of bytes send before compression and received after decompression;
340+
- physical counters show number of physical packets and bytes send and
341+
received over the wire, number of bytes could be affected by wire compression,
342+
if present. Also, number of network roundtrips is shown: it is number of
343+
changes of IO direction from 'send' to 'receive'.
344+
345+
Note, wire statistics is gathered by Remote provider only, i.e. it is always
346+
zero for embedded connections. Also, it is collected by client and IO direction
347+
(send, receive) is shown from client point of view.
348+
349+
Examples:
350+
351+
1. INET protocol with wire compression.
352+
Set WireCompression = true in firebird.conf
353+
354+
>isql inet://employee
355+
356+
SQL> SET;
357+
Print statistics: OFF
358+
Print per-table stats: OFF
359+
Print wire stats: OFF
360+
...
361+
362+
SQL> SET WIRE;
363+
SQL>
364+
SQL> SELECT COUNT(*) FROM RDB$RELATIONS;
365+
366+
COUNT
367+
=====================
368+
67
369+
370+
Wire logical statistics:
371+
send packets = 6
372+
recv packets = 5
373+
send bytes = 184
374+
recv bytes = 224
375+
Wire physical statistics:
376+
send packets = 3
377+
recv packets = 2
378+
send bytes = 123
379+
recv bytes = 88
380+
roundtrips = 2
381+
382+
Note difference due to wire compression in send/recv bytes for logical and
383+
physical stats.
384+
385+
386+
2. XNET protocol (wire compression is not used).
387+
388+
>isql xnet://employee
389+
390+
SQL> SET WIRE;
391+
SQL>
392+
SQL> SELECT COUNT(*) FROM RDB$RELATIONS;
393+
394+
COUNT
395+
=====================
396+
67
397+
398+
Wire logical statistics:
399+
send packets = 5
400+
recv packets = 6
401+
send bytes = 176
402+
recv bytes = 256
403+
Wire physical statistics:
404+
send packets = 5
405+
recv packets = 5
406+
send bytes = 176
407+
recv bytes = 256
408+
roundtrips = 5
409+
410+
Note, send/recv bytes for logical and physical stats are equal.
411+
412+
413+
3. Embedded connection (wire statistics is absent).
414+
415+
SQL> SET WIRE;
416+
SQL>
417+
SQL> select count(*) from rdb$relations;
418+
419+
COUNT
420+
=====================
421+
67
422+
423+
Wire logical statistics:
424+
send packets = 0
425+
recv packets = 0
426+
send bytes = 0
427+
recv bytes = 0
428+
Wire physical statistics:
429+
send packets = 0
430+
recv packets = 0
431+
send bytes = 0
432+
recv bytes = 0
433+
roundtrips = 0
434+
435+
436+
437+
13) SHOW WIRE_STATISTICS command.
438+
439+
Author: Vladyslav Khorsun <hvlad at users sourceforge net>
440+
441+
New ISQL command that shows accumulated wire statistics. There is also
442+
shortened alias WIRE_STATS.
443+
444+
The command show values of wire statistics counters, accumulated since the
445+
connection start time. Format is the same as of SET STATS above.
446+
447+
448+
330449
Isql enhancements in Firebird v6.
331450
---------------------------------
332451

333-
12) EXPLAIN statement.
452+
14) EXPLAIN statement.
334453

335454
Author: Adriano dos Santos Fernandes
336455

@@ -355,7 +474,7 @@ SQL>
355474
SQL> set term ;!
356475

357476

358-
13) SET AUTOTERM ON/OFF
477+
15) SET AUTOTERM ON/OFF
359478

360479
Author: Adriano dos Santos Fernandes
361480

src/burp/BurpTasks.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,13 @@ class IOBuffer
545545
if (!m_mutex.tryEnter(FB_FUNCTION))
546546
return;
547547

548+
fb_assert(m_locked >= 0);
549+
const bool lockedByMe = (m_locked != 0);
550+
548551
m_mutex.leave();
552+
553+
if (!lockedByMe)
554+
return;
549555
}
550556

551557
fb_assert(m_locked > 0);

src/include/firebird/impl/inf_pub.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ enum db_info_types
178178

179179
fb_info_parallel_workers = 149,
180180

181+
// Wire stats items, implemented by Remote provider only
182+
fb_info_wire_out_packets = 150,
183+
fb_info_wire_in_packets = 151,
184+
fb_info_wire_out_bytes = 152,
185+
fb_info_wire_in_bytes = 153,
186+
fb_info_wire_snd_packets = 154,
187+
fb_info_wire_rcv_packets = 155,
188+
fb_info_wire_snd_bytes = 156,
189+
fb_info_wire_rcv_bytes = 157,
190+
fb_info_wire_roundtrips = 158,
191+
181192
isc_info_db_last_value /* Leave this LAST! */
182193
};
183194

src/include/gen/Firebird.pas

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4507,6 +4507,15 @@ IProfilerStatsImpl = class(IProfilerStats)
45074507
fb_info_username = byte(147);
45084508
fb_info_sqlrole = byte(148);
45094509
fb_info_parallel_workers = byte(149);
4510+
fb_info_wire_out_packets = byte(150);
4511+
fb_info_wire_in_packets = byte(151);
4512+
fb_info_wire_out_bytes = byte(152);
4513+
fb_info_wire_in_bytes = byte(153);
4514+
fb_info_wire_snd_packets = byte(154);
4515+
fb_info_wire_rcv_packets = byte(155);
4516+
fb_info_wire_snd_bytes = byte(156);
4517+
fb_info_wire_rcv_bytes = byte(157);
4518+
fb_info_wire_roundtrips = byte(158);
45104519
fb_info_crypt_encrypted = $01;
45114520
fb_info_crypt_process = $02;
45124521
fb_feature_multi_statements = byte(1);

0 commit comments

Comments
 (0)