Coverage report: /development/source/library/com/dydra/gitlab/dydra-cgi/ffi/lisp/dydra-ndk/query.lisp
| Kind | Covered | All | % |
| expression | 0 | 86 | 0.0 |
| branch | 0 | 2 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package :dydra-ndk)
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
(defcfun ("dydra_query_tally_by_uuid_str" %%query-tally) :void (query-uuid-string :string) (key :string) (value :string))
7
;; BGP queries are opaque dydra::bgp_query structures allocated on the
8
;; foreign heap and referenced indirectly through a foreign pointer.
9
(defctype bgp-query :pointer
12
;; SPARQL queries are opaque dydra::sparql_query structures allocated on the
13
;; foreign heap and referenced indirectly through a foreign pointer.
14
(defctype sparql-query :pointer
15
"SPARQL query handle.")
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19
(defun record-query-accounting-entry (query-uuid-string key value)
20
(declare (type string query-uuid-string)
21
(type (or string null) key))
23
(%%query-tally query-uuid-string key (write-to-string value)))
26
(defun %record-query-accounting (query-uuid-string query-accounting)
27
(declare (type (or string foreign-pointer) query-uuid-string)
28
(type list query-accounting)) ;; a plist, more specifically
29
(loop for (k v) on query-accounting by #'cddr do
30
;(format t "k=~S v=~S ~%" k v) ; DEBUG
33
(record-query-accounting-entry query-uuid-string nil v)) ;; ignored
35
(record-query-accounting-entry query-uuid-string nil v)) ;; ignored
36
(:|solutions_returned|
37
(record-query-accounting-entry query-uuid-string "solutions-returned" v))
38
(:|solutions_processed|
39
(record-query-accounting-entry query-uuid-string "solutions-processed" v))
40
(:|solutions_constructed|
41
(record-query-accounting-entry query-uuid-string "solutions-constructed" v))
42
((:|real_time| :|elapsed_time|)
43
(record-query-accounting-entry query-uuid-string "elapsed-time" v))
45
(record-query-accounting-entry query-uuid-string nil v)) ;; ignored
46
((:|run_time| :|process_time|)
47
(record-query-accounting-entry query-uuid-string "process-time" v))
49
(record-query-accounting-entry query-uuid-string "match-responses" v))
51
(record-query-accounting-entry query-uuid-string "match-requests" v))
53
(record-query-accounting-entry query-uuid-string "bytes-allocated" v))
54
(:|algebra_operations|
55
(record-query-accounting-entry query-uuid-string "algebra-operations" v))
57
(record-query-accounting-entry query-uuid-string nil v)) ;; ignored
59
(record-query-accounting-entry query-uuid-string nil v)) ;; ignored
60
(otherwise nil))) ;; ignore unknown keys, for future-proofness
61
(let ((null-pointer (null-pointer)))
62
(%%query-tally query-uuid-string null-pointer null-pointer))
65
(defun record-query-accounting (&rest arguments)
66
(ecase (length arguments)
67
(2 (apply #'%record-query-accounting arguments))
68
(4 (%record-query-accounting (first arguments) (fourth arguments)))))