add a test to benchmark database performance

pull/135/head
Michael Zanetti 2017-09-14 20:41:14 +02:00
parent d800f6cf4f
commit 314129a76f
8 changed files with 284 additions and 34 deletions

View File

@ -12,228 +12,267 @@
<context>
<name>MockDevice</name>
<message>
<location filename="../plugininfo.h" line="100"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="100"/>
<source>guh</source>
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
<translation>guh</translation>
</message>
<message>
<location filename="../plugininfo.h" line="103"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="103"/>
<source>Mock Device</source>
<extracomment>The name of the DeviceClass (753f0d32-0468-4d08-82ed-1964aab03298)</extracomment>
<translation>Mock Gerät</translation>
</message>
<message>
<location filename="../plugininfo.h" line="106"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="106"/>
<source>http port</source>
<extracomment>The name of the paramType (d4f06047-125e-4479-9810-b54c189917f5) of Mock Device</extracomment>
<translation>HTTP Port</translation>
</message>
<message>
<location filename="../plugininfo.h" line="142"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="142"/>
<source>Mock Action 3 (async)</source>
<extracomment>The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass Mock Device</extracomment>
<translation>Mock Aktion 3 (async)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="145"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="145"/>
<source>Mock Action 4 (broken)</source>
<extracomment>The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass Mock Device</extracomment>
<translation>Mock Aktion 4 (kaputt)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="148"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="148"/>
<source>Mock Action 5 (async, broken)</source>
<extracomment>The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass Mock Device</extracomment>
<translation>Mock Aktion 5 (async, kaputt)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="154"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="154"/>
<source>Mock Device (Auto created)</source>
<extracomment>The name of the DeviceClass (ab4257b3-7548-47ee-9bd4-7dc3004fd197)</extracomment>
<translation>Mock Gerät (Auto erstellt)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="166"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="166"/>
<source>Mock Device (Push Button)</source>
<extracomment>The name of the DeviceClass (9e03144c-e436-4eea-82d9-ccb33ef778db)</extracomment>
<translation>Mock Gerät (Drückknopf)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="163"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="163"/>
<source>Wait 3 second before you continue, the push button will be pressed automatically.</source>
<extracomment>The pairing info of deviceClass Mock Device (Push Button)</extracomment>
<translation>Warte 3 Sekunden bevor du fortfährst, the Knopf wird automatisch gerückt.</translation>
</message>
<message>
<location filename="../plugininfo.h" line="94"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="94"/>
<source>configParamInt</source>
<extracomment>The name of the paramType (e1f72121-a426-45e2-b475-8262b5cdf103) of Mock Devices</extracomment>
<translation>configParamInt</translation>
</message>
<message>
<location filename="../plugininfo.h" line="97"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="97"/>
<source>configParamBool</source>
<extracomment>The name of the paramType (c75723b6-ea4f-4982-9751-6c5e39c88145) of Mock Devices</extracomment>
<translation>configParamBool</translation>
</message>
<message>
<location filename="../plugininfo.h" line="109"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="109"/>
<source>async</source>
<extracomment>The name of the paramType (f2977061-4dd0-4ef5-85aa-3b7134743be3) of Mock Device</extracomment>
<translation>async</translation>
</message>
<message>
<location filename="../plugininfo.h" line="112"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="112"/>
<source>broken</source>
<extracomment>The name of the paramType (ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) of Mock Device</extracomment>
<translation>kaputt</translation>
</message>
<message>
<location filename="../plugininfo.h" line="115"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="115"/>
<source>resultCount</source>
<extracomment>The name of the paramType (d222adb4-2f9c-4c3f-8655-76400d0fb6ce) of Mock Device</extracomment>
<translation>Resultat Anzahl</translation>
</message>
<message>
<location filename="../plugininfo.h" line="118"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="118"/>
<source>Dummy int state changed</source>
<extracomment>The name of the autocreated EventType (80baec19-54de-4948-ac46-31eabfaceb83)</extracomment>
<translation>Int Zustand verändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="121"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="121"/>
<source>Dummy int state</source>
<extracomment>The name of the ParamType of StateType (80baec19-54de-4948-ac46-31eabfaceb83) of DeviceClass Mock Device</extracomment>
<translation>Dummy Int Zustand</translation>
</message>
<message>
<location filename="../plugininfo.h" line="124"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="124"/>
<source>Dummy bool state changed</source>
<extracomment>The name of the autocreated EventType (9dd6a97c-dfd1-43dc-acbd-367932742310)</extracomment>
<translation>Bool Zustand verändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="127"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="127"/>
<source>Dummy bool state</source>
<extracomment>The name of the ParamType of StateType (9dd6a97c-dfd1-43dc-acbd-367932742310) of DeviceClass Mock Device</extracomment>
<translation>Dummy Bool Zustand</translation>
</message>
<message>
<location filename="../plugininfo.h" line="130"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="130"/>
<source>Mock Action 1 (with params)</source>
<extracomment>The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass Mock Device</extracomment>
<translation>Mock Aktion 1 (Mit Parametern)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="133"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="133"/>
<source>mockActionParam1</source>
<extracomment>The name of the paramType (a2d3a256-a551-4712-a65b-ecd5a436a1cb) of Mock Device</extracomment>
<translation>mockActionParam1</translation>
</message>
<message>
<location filename="../plugininfo.h" line="136"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="136"/>
<source>mockActionParam2</source>
<extracomment>The name of the paramType (304a4899-18be-4e3b-94f4-d03be52f3233) of Mock Device</extracomment>
<translation>mockActionParam2</translation>
</message>
<message>
<location filename="../plugininfo.h" line="139"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="139"/>
<source>Mock Action 2 (without params)</source>
<extracomment>The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass Mock Device</extracomment>
<translation>Mock Aktion (ohne Parameter</translation>
</message>
<message>
<location filename="../plugininfo.h" line="151"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="151"/>
<source>mockParamInt</source>
<extracomment>The name of the paramType (0550e16d-60b9-4ba5-83f4-4d3cee656121) of Mock Device</extracomment>
<translation>mockParamInt</translation>
</message>
<message>
<location filename="../plugininfo.h" line="157"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="157"/>
<source>Mock Event 1</source>
<extracomment>The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass Mock Device (Auto created)</extracomment>
<translation>Mock Event 1</translation>
</message>
<message>
<location filename="../plugininfo.h" line="160"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="160"/>
<source>Mock Event 2</source>
<extracomment>The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass Mock Device (Auto created)</extracomment>
<translation>Mock Event 2</translation>
</message>
<message>
<location filename="../plugininfo.h" line="169"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="169"/>
<source>color changed</source>
<extracomment>The name of the autocreated EventType (20dc7c22-c50e-42db-837c-2bbced939f8e)</extracomment>
<translation>Farbe geändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="172"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="172"/>
<source>color</source>
<extracomment>The name of the ParamType of StateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of DeviceClass Mock Device (Push Button)</extracomment>
<translation>Farbe</translation>
</message>
<message>
<location filename="../plugininfo.h" line="175"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="175"/>
<source>Set color</source>
<extracomment>The name of the autocreated ActionType (20dc7c22-c50e-42db-837c-2bbced939f8e)</extracomment>
<translation>Setze Farbe</translation>
</message>
<message>
<location filename="../plugininfo.h" line="178"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="178"/>
<source>percentage changed</source>
<extracomment>The name of the autocreated EventType (72981c04-267a-4ba0-a59e-9921d2f3af9c)</extracomment>
<translation>Prozent gändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="181"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="181"/>
<source>percentage</source>
<extracomment>The name of the ParamType of StateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of DeviceClass Mock Device (Push Button)</extracomment>
<translation>Prozent</translation>
</message>
<message>
<location filename="../plugininfo.h" line="184"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="184"/>
<source>Set percentage</source>
<extracomment>The name of the autocreated ActionType (72981c04-267a-4ba0-a59e-9921d2f3af9c)</extracomment>
<translation>Setze Prozentwert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="187"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="187"/>
<source>allowed values changed</source>
<extracomment>The name of the autocreated EventType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b)</extracomment>
<translation>Erlaubter Wert geändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="190"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="190"/>
<source>allowed values</source>
<extracomment>The name of the ParamType of StateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of DeviceClass Mock Device (Push Button)</extracomment>
<translation>Erlaubte Werte</translation>
</message>
<message>
<location filename="../plugininfo.h" line="193"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="193"/>
<source>Set allowed values</source>
<extracomment>The name of the autocreated ActionType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b)</extracomment>
<translation>Setze erlaubten Wert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="196"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="196"/>
<source>double value changed</source>
<extracomment>The name of the autocreated EventType (53cd7c55-49b7-441b-b970-9048f20f0e2c)</extracomment>
<translation>Double Wert geändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="199"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="199"/>
<source>double value</source>
<extracomment>The name of the ParamType of StateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of DeviceClass Mock Device (Push Button)</extracomment>
<translation>Double Wert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="202"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="202"/>
<source>Set double value</source>
<extracomment>The name of the autocreated ActionType (53cd7c55-49b7-441b-b970-9048f20f0e2c)</extracomment>
<translation>Setze double Wert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="211"/>
<location filename="../plugininfo.h" line="235"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="211"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="235"/>
<source>Set bool value</source>
@ -243,18 +282,22 @@ The name of the autocreated ActionType (d24ede5f-4064-4898-bb84-cfb533b1fbc0)</e
<translation>Setze boll Wert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="214"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="214"/>
<source>Timeout action</source>
<extracomment>The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Push Button)</extracomment>
<translation>Timeout Aktion</translation>
</message>
<message>
<location filename="../plugininfo.h" line="220"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="220"/>
<source>Mock Device (Display Pin)</source>
<extracomment>The name of the DeviceClass (296f1fd4-e893-46b2-8a42-50d1bceb8730)</extracomment>
<translation>Mock Gerät (Pin anzeigen)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="205"/>
<location filename="../plugininfo.h" line="229"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="205"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="229"/>
<source>bool value changed</source>
@ -264,6 +307,8 @@ The name of the autocreated EventType (d24ede5f-4064-4898-bb84-cfb533b1fbc0)</ex
<translation>Bool Wert geändert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="208"/>
<location filename="../plugininfo.h" line="232"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="208"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="232"/>
<source>bool value</source>
@ -273,96 +318,112 @@ The name of the ParamType of StateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of
<translation>Bool Wert</translation>
</message>
<message>
<location filename="../plugininfo.h" line="247"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="247"/>
<source>Text line</source>
<extracomment>The name of the paramType (e6acf0c7-4b8e-4296-ac62-855d20deb816) of Mock Device (InputTypes)</extracomment>
<translation>Textzeile</translation>
</message>
<message>
<location filename="../plugininfo.h" line="250"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="250"/>
<source>Text area</source>
<extracomment>The name of the paramType (716f0994-bc01-42b0-b64d-59236f7320d2) of Mock Device (InputTypes)</extracomment>
<translation>Textfeld</translation>
</message>
<message>
<location filename="../plugininfo.h" line="253"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="253"/>
<source>Password text</source>
<extracomment>The name of the paramType (e5c0d14b-c9f1-4aca-a56e-85bfa6977150) of Mock Device (InputTypes)</extracomment>
<translation>Passwort Text</translation>
</message>
<message>
<location filename="../plugininfo.h" line="256"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="256"/>
<source>Search text</source>
<extracomment>The name of the paramType (22add8c9-ee4f-43ad-8931-58e999313ac3) of Mock Device (InputTypes)</extracomment>
<translation>Suchtext</translation>
</message>
<message>
<location filename="../plugininfo.h" line="259"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="259"/>
<source>Mail address</source>
<extracomment>The name of the paramType (a8494faf-3a0f-4cf3-84b7-4b39148a838d) of Mock Device (InputTypes)</extracomment>
<translation>Mail Adresse</translation>
</message>
<message>
<location filename="../plugininfo.h" line="262"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="262"/>
<source>IPv4 address</source>
<extracomment>The name of the paramType (9e5f86a0-4bb3-4892-bff8-3fc4032af6e2) of Mock Device (InputTypes)</extracomment>
<translation>IPv4 Adresse</translation>
</message>
<message>
<location filename="../plugininfo.h" line="265"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="265"/>
<source>IPv6 address</source>
<extracomment>The name of the paramType (43bf3832-dd48-4090-a836-656e8b60216e) of Mock Device (InputTypes)</extracomment>
<translation>IPv6 Adresse</translation>
</message>
<message>
<location filename="../plugininfo.h" line="268"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="268"/>
<source>URL</source>
<extracomment>The name of the paramType (fa67229f-fcef-496f-b671-59a4b48f3ab5) of Mock Device (InputTypes)</extracomment>
<translation>URL</translation>
</message>
<message>
<location filename="../plugininfo.h" line="271"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="271"/>
<source>Mac address</source>
<extracomment>The name of the paramType (e93db587-7919-48f3-8c88-1651de63c765) of Mock Device (InputTypes)</extracomment>
<translation>Mac Adresse</translation>
</message>
<message>
<location filename="../plugininfo.h" line="217"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="217"/>
<source>Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.</source>
<extracomment>The pairing info of deviceClass Mock Device (Display Pin)</extracomment>
<translation>Bitte geben sie den Pincode ein der normalerweise auf dem Gerät angezeit werden würde. In diesem fall lautet der Pincode 243681.</translation>
</message>
<message>
<location filename="../plugininfo.h" line="91"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="91"/>
<source>Mock Devices</source>
<extracomment>The name of the plugin Mock Devices (727a4a9a-c187-446f-aadf-f1b2220607d1)</extracomment>
<translation>Mock Gerät</translation>
</message>
<message>
<location filename="../plugininfo.h" line="223"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="223"/>
<source>pin</source>
<extracomment>The name of the paramType (da820e07-22dc-4173-9c07-2f49a4e265f9) of Mock Device (Display Pin)</extracomment>
<translation>Pin</translation>
</message>
<message>
<location filename="../plugininfo.h" line="226"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="226"/>
<source>Mock Device (Parent)</source>
<extracomment>The name of the DeviceClass (a71fbde9-9a38-4bf8-beab-c8aade2608ba)</extracomment>
<translation>Mock Gerät (Elternteil)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="238"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="238"/>
<source>Mock Device (Child)</source>
<extracomment>The name of the DeviceClass (40893c9f-bc47-40c1-8bf7-b390c7c1b4fc)</extracomment>
<translation>Mock Gerät (Kind)</translation>
</message>
<message>
<location filename="../plugininfo.h" line="241"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="241"/>
<source>parent uuid</source>
<extracomment>The name of the paramType (104b5288-404e-42d3-bf38-e40682e75681) of Mock Device (Child)</extracomment>
<translation>Elternteil Uuid</translation>
</message>
<message>
<location filename="../plugininfo.h" line="244"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="244"/>
<source>Mock Device (InputTypes)</source>
<extracomment>The name of the DeviceClass (515ffdf1-55e5-498d-9abc-4e2fe768f3a9)</extracomment>

View File

@ -12,228 +12,267 @@
<context>
<name>MockDevice</name>
<message>
<location filename="../plugininfo.h" line="100"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="100"/>
<source>guh</source>
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="103"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="103"/>
<source>Mock Device</source>
<extracomment>The name of the DeviceClass (753f0d32-0468-4d08-82ed-1964aab03298)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="106"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="106"/>
<source>http port</source>
<extracomment>The name of the paramType (d4f06047-125e-4479-9810-b54c189917f5) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="142"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="142"/>
<source>Mock Action 3 (async)</source>
<extracomment>The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="145"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="145"/>
<source>Mock Action 4 (broken)</source>
<extracomment>The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="148"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="148"/>
<source>Mock Action 5 (async, broken)</source>
<extracomment>The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="154"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="154"/>
<source>Mock Device (Auto created)</source>
<extracomment>The name of the DeviceClass (ab4257b3-7548-47ee-9bd4-7dc3004fd197)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="166"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="166"/>
<source>Mock Device (Push Button)</source>
<extracomment>The name of the DeviceClass (9e03144c-e436-4eea-82d9-ccb33ef778db)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="163"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="163"/>
<source>Wait 3 second before you continue, the push button will be pressed automatically.</source>
<extracomment>The pairing info of deviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="94"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="94"/>
<source>configParamInt</source>
<extracomment>The name of the paramType (e1f72121-a426-45e2-b475-8262b5cdf103) of Mock Devices</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="97"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="97"/>
<source>configParamBool</source>
<extracomment>The name of the paramType (c75723b6-ea4f-4982-9751-6c5e39c88145) of Mock Devices</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="109"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="109"/>
<source>async</source>
<extracomment>The name of the paramType (f2977061-4dd0-4ef5-85aa-3b7134743be3) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="112"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="112"/>
<source>broken</source>
<extracomment>The name of the paramType (ae8f8901-f2c1-42a5-8111-6d2fc8e4c1e4) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="115"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="115"/>
<source>resultCount</source>
<extracomment>The name of the paramType (d222adb4-2f9c-4c3f-8655-76400d0fb6ce) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="118"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="118"/>
<source>Dummy int state changed</source>
<extracomment>The name of the autocreated EventType (80baec19-54de-4948-ac46-31eabfaceb83)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="121"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="121"/>
<source>Dummy int state</source>
<extracomment>The name of the ParamType of StateType (80baec19-54de-4948-ac46-31eabfaceb83) of DeviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="124"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="124"/>
<source>Dummy bool state changed</source>
<extracomment>The name of the autocreated EventType (9dd6a97c-dfd1-43dc-acbd-367932742310)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="127"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="127"/>
<source>Dummy bool state</source>
<extracomment>The name of the ParamType of StateType (9dd6a97c-dfd1-43dc-acbd-367932742310) of DeviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="130"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="130"/>
<source>Mock Action 1 (with params)</source>
<extracomment>The name of the ActionType dea0f4e1-65e3-4981-8eaa-2701c53a9185 of deviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="133"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="133"/>
<source>mockActionParam1</source>
<extracomment>The name of the paramType (a2d3a256-a551-4712-a65b-ecd5a436a1cb) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="136"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="136"/>
<source>mockActionParam2</source>
<extracomment>The name of the paramType (304a4899-18be-4e3b-94f4-d03be52f3233) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="139"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="139"/>
<source>Mock Action 2 (without params)</source>
<extracomment>The name of the ActionType defd3ed6-1a0d-400b-8879-a0202cf39935 of deviceClass Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="151"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="151"/>
<source>mockParamInt</source>
<extracomment>The name of the paramType (0550e16d-60b9-4ba5-83f4-4d3cee656121) of Mock Device</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="157"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="157"/>
<source>Mock Event 1</source>
<extracomment>The name of the EventType 45bf3752-0fc6-46b9-89fd-ffd878b5b22b of deviceClass Mock Device (Auto created)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="160"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="160"/>
<source>Mock Event 2</source>
<extracomment>The name of the EventType 863d5920-b1cf-4eb9-88bd-8f7b8583b1cf of deviceClass Mock Device (Auto created)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="169"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="169"/>
<source>color changed</source>
<extracomment>The name of the autocreated EventType (20dc7c22-c50e-42db-837c-2bbced939f8e)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="172"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="172"/>
<source>color</source>
<extracomment>The name of the ParamType of StateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of DeviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="175"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="175"/>
<source>Set color</source>
<extracomment>The name of the autocreated ActionType (20dc7c22-c50e-42db-837c-2bbced939f8e)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="178"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="178"/>
<source>percentage changed</source>
<extracomment>The name of the autocreated EventType (72981c04-267a-4ba0-a59e-9921d2f3af9c)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="181"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="181"/>
<source>percentage</source>
<extracomment>The name of the ParamType of StateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of DeviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="184"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="184"/>
<source>Set percentage</source>
<extracomment>The name of the autocreated ActionType (72981c04-267a-4ba0-a59e-9921d2f3af9c)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="187"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="187"/>
<source>allowed values changed</source>
<extracomment>The name of the autocreated EventType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="190"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="190"/>
<source>allowed values</source>
<extracomment>The name of the ParamType of StateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of DeviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="193"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="193"/>
<source>Set allowed values</source>
<extracomment>The name of the autocreated ActionType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="196"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="196"/>
<source>double value changed</source>
<extracomment>The name of the autocreated EventType (53cd7c55-49b7-441b-b970-9048f20f0e2c)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="199"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="199"/>
<source>double value</source>
<extracomment>The name of the ParamType of StateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of DeviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="202"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="202"/>
<source>Set double value</source>
<extracomment>The name of the autocreated ActionType (53cd7c55-49b7-441b-b970-9048f20f0e2c)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="211"/>
<location filename="../plugininfo.h" line="235"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="211"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="235"/>
<source>Set bool value</source>
@ -243,18 +282,22 @@ The name of the autocreated ActionType (d24ede5f-4064-4898-bb84-cfb533b1fbc0)</e
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="214"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="214"/>
<source>Timeout action</source>
<extracomment>The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Push Button)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="220"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="220"/>
<source>Mock Device (Display Pin)</source>
<extracomment>The name of the DeviceClass (296f1fd4-e893-46b2-8a42-50d1bceb8730)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="205"/>
<location filename="../plugininfo.h" line="229"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="205"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="229"/>
<source>bool value changed</source>
@ -264,6 +307,8 @@ The name of the autocreated EventType (d24ede5f-4064-4898-bb84-cfb533b1fbc0)</ex
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="208"/>
<location filename="../plugininfo.h" line="232"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="208"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="232"/>
<source>bool value</source>
@ -273,96 +318,112 @@ The name of the ParamType of StateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="247"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="247"/>
<source>Text line</source>
<extracomment>The name of the paramType (e6acf0c7-4b8e-4296-ac62-855d20deb816) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="250"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="250"/>
<source>Text area</source>
<extracomment>The name of the paramType (716f0994-bc01-42b0-b64d-59236f7320d2) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="253"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="253"/>
<source>Password text</source>
<extracomment>The name of the paramType (e5c0d14b-c9f1-4aca-a56e-85bfa6977150) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="256"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="256"/>
<source>Search text</source>
<extracomment>The name of the paramType (22add8c9-ee4f-43ad-8931-58e999313ac3) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="259"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="259"/>
<source>Mail address</source>
<extracomment>The name of the paramType (a8494faf-3a0f-4cf3-84b7-4b39148a838d) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="262"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="262"/>
<source>IPv4 address</source>
<extracomment>The name of the paramType (9e5f86a0-4bb3-4892-bff8-3fc4032af6e2) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="265"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="265"/>
<source>IPv6 address</source>
<extracomment>The name of the paramType (43bf3832-dd48-4090-a836-656e8b60216e) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="268"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="268"/>
<source>URL</source>
<extracomment>The name of the paramType (fa67229f-fcef-496f-b671-59a4b48f3ab5) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="271"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="271"/>
<source>Mac address</source>
<extracomment>The name of the paramType (e93db587-7919-48f3-8c88-1651de63c765) of Mock Device (InputTypes)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="217"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="217"/>
<source>Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.</source>
<extracomment>The pairing info of deviceClass Mock Device (Display Pin)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="91"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="91"/>
<source>Mock Devices</source>
<extracomment>The name of the plugin Mock Devices (727a4a9a-c187-446f-aadf-f1b2220607d1)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="223"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="223"/>
<source>pin</source>
<extracomment>The name of the paramType (da820e07-22dc-4173-9c07-2f49a4e265f9) of Mock Device (Display Pin)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="226"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="226"/>
<source>Mock Device (Parent)</source>
<extracomment>The name of the DeviceClass (a71fbde9-9a38-4bf8-beab-c8aade2608ba)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="238"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="238"/>
<source>Mock Device (Child)</source>
<extracomment>The name of the DeviceClass (40893c9f-bc47-40c1-8bf7-b390c7c1b4fc)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="241"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="241"/>
<source>parent uuid</source>
<extracomment>The name of the paramType (104b5288-404e-42d3-bf38-e40682e75681) of Mock Device (Child)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="244"/>
<location filename="../../../../build-guh-Desktop-Debug/plugins/mock/plugininfo.h" line="244"/>
<source>Mock Device (InputTypes)</source>
<extracomment>The name of the DeviceClass (515ffdf1-55e5-498d-9abc-4e2fe768f3a9)</extracomment>

View File

@ -135,7 +135,8 @@ LogEngine::LogEngine(QObject *parent):
{
m_db = QSqlDatabase::addDatabase("QSQLITE", "logs");
m_db.setDatabaseName(GuhSettings::logPath());
m_dbMaxSize = 20000;
m_dbMaxSize = 50000;
m_overflow = 100;
if (QCoreApplication::instance()->organizationName() == "guh-test") {
m_dbMaxSize = 20;
@ -160,6 +161,12 @@ LogEngine::LogEngine(QObject *parent):
qCWarning(dcLogEngine()) << "Error fixing log database. Giving up. Logs can't be stored.";
}
}
connect(&m_housekeepingTimer, &QTimer::timeout, this, &LogEngine::checkDBSize);
m_housekeepingTimer.setInterval(1); // Trigger on next idle event loop run
m_housekeepingTimer.setSingleShot(true);
checkDBSize();
}
/*! Destructs the \l{LogEngine}. */
@ -211,6 +218,13 @@ QList<LogEntry> LogEngine::logEntries(const LogFilter &filter) const
return results;
}
void LogEngine::setMaxLogEntries(int maxLogEntries, int overflow)
{
m_dbMaxSize = maxLogEntries;
m_overflow = overflow;
checkDBSize();
}
/*! Removes all entries from the database. This method will be used for the tests. */
void LogEngine::clearDatabase()
{
@ -337,7 +351,6 @@ void LogEngine::removeRuleLogs(const RuleId &ruleId)
void LogEngine::appendLogEntry(const LogEntry &entry)
{
checkDBSize();
QString queryString = QString("INSERT INTO entries (timestamp, loggingEventType, loggingLevel, sourceType, typeId, deviceId, value, active, errorCode) values ('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9');")
.arg(entry.timestamp().toTime_t())
.arg(entry.eventType())
@ -356,31 +369,41 @@ void LogEngine::appendLogEntry(const LogEntry &entry)
}
emit logEntryAdded(entry);
if (++m_entryCount > m_dbMaxSize + m_overflow) {
m_housekeepingTimer.start();
}
}
void LogEngine::checkDBSize()
{
QString queryString = "SELECT ROWID FROM entries;";
QSqlQuery query = m_db.exec(queryString);
int numRows = 0;
if (m_db.driver()->hasFeature(QSqlDriver::QuerySize)) {
numRows = query.size();
} else {
// this can be very slow
query.last();
numRows = query.at() + 1;
QDateTime startTime = QDateTime::currentDateTime();
QString queryString = "SELECT COUNT(*) FROM entries;";
QSqlQuery result = m_db.exec(queryString);
if (m_db.lastError().type() != QSqlError::NoError) {
qWarning(dcLogEngine()) << "Failed to query entry count in db:" << m_db.lastError().databaseText();
return;
}
if (!result.first()) {
qWarning(dcLogEngine()) << "Failed retrieving entry count.";
return;
}
m_entryCount = result.value(0).toInt();
if (numRows >= m_dbMaxSize) {
if (m_entryCount >= m_dbMaxSize) {
// keep only the latest m_dbMaxSize entries
qCDebug(dcLogEngine) << "Deleting oldest entries and keep only the latest" << m_dbMaxSize << "entries.";
if (!m_trimWarningPrinted) {
qCDebug(dcLogEngine) << "Deleting oldest entries" << (m_entryCount - m_dbMaxSize) << "and keep only the latest" << m_dbMaxSize << "entries.";
m_trimWarningPrinted = true;
}
QString queryDeleteString = QString("DELETE FROM entries WHERE ROWID IN (SELECT ROWID FROM entries ORDER BY timestamp DESC LIMIT -1 OFFSET %1);").arg(QString::number(m_dbMaxSize));
if (m_db.exec(queryDeleteString).lastError().type() != QSqlError::NoError) {
qCWarning(dcLogEngine) << "Error deleting oldest log entries to keep size. Driver error:" << m_db.lastError().driverText() << "Database error:" << m_db.lastError().databaseText();
} else {
emit logDatabaseUpdated();
}
m_entryCount = m_dbMaxSize;
emit logDatabaseUpdated();
}
qCDebug(dcLogEngine()) << "Ran housekeeping on log database in" << startTime.msecsTo(QDateTime::currentDateTime()) << "ms.";
}
void LogEngine::rotate(const QString &dbName)

View File

@ -30,6 +30,7 @@
#include <QObject>
#include <QSqlDatabase>
#include <QTimer>
namespace guhserver {
@ -42,27 +43,9 @@ public:
QList<LogEntry> logEntries(const LogFilter &filter = LogFilter()) const;
void setMaxLogEntries(int maxLogEntries, int overflow);
void clearDatabase();
signals:
void logEntryAdded(const LogEntry &logEntry);
void logDatabaseUpdated();
private:
QSqlDatabase m_db;
int m_dbMaxSize;
bool initDB();
void appendLogEntry(const LogEntry &entry);
void checkDBSize();
void rotate(const QString &dbName);
private:
// Only GuhCore and ruleEngine are allowed to log events.
friend class GuhCore;
friend class RuleEngine;
void logSystemEvent(const QDateTime &dateTime, bool active, Logging::LoggingLevel level = Logging::LoggingLevelInfo);
void logEvent(const Event &event);
void logAction(const Action &action, Logging::LoggingLevel level = Logging::LoggingLevelInfo, int errorCode = 0);
@ -74,6 +57,25 @@ private:
void removeDeviceLogs(const DeviceId &deviceId);
void removeRuleLogs(const RuleId &ruleId);
signals:
void logEntryAdded(const LogEntry &logEntry);
void logDatabaseUpdated();
private:
bool initDB();
void appendLogEntry(const LogEntry &entry);
void rotate(const QString &dbName);
private slots:
void checkDBSize();
private:
QSqlDatabase m_db;
int m_dbMaxSize;
int m_overflow;
bool m_trimWarningPrinted = false;
int m_entryCount = 0;
QTimer m_housekeepingTimer;
};
}

View File

@ -15,6 +15,7 @@ SUBDIRS = versioning \
restrules \
websocketserver \
logging \
loggingdirect \
restlogging \
#coap \ # temporary removed until fixed
configurations \

View File

@ -0,0 +1,5 @@
include(../../../guh.pri)
include(../autotests.pri)
TARGET = testloggingdirect
SOURCES += testloggingdirect.cpp

Binary file not shown.

View File

@ -0,0 +1,97 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2017 Michael Zanetti <michael.zanetti@guh.io> *
* *
* This file is part of guh. *
* *
* Guh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 2 of the License. *
* *
* Guh is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <QtTest>
#include "logging/logengine.h"
using namespace guhserver;
class TestLoggingDirect: public QObject
{
Q_OBJECT
public:
TestLoggingDirect(QObject* parent = nullptr);
private slots:
void benchmarkDB_data();
void benchmarkDB();
private:
LogEngine engine;
};
TestLoggingDirect::TestLoggingDirect(QObject *parent): QObject(parent)
{
// Setting timeout to 20 mins
qputenv("QTEST_FUNCTION_TIMEOUT", "1200000");
}
void TestLoggingDirect::benchmarkDB_data() {
QTest::addColumn<int>("prefill");
QTest::addColumn<int>("maxSize");
QTest::newRow("empty, no trim") << 0 << 20000;
QTest::newRow("empty, trim") << 1 << 1;
QTest::newRow("10000, no trim") << 10000 << 20000;
QTest::newRow("10000, trim") << 10000 << 10000;
QTest::newRow("20000, no trim") << 20000 << 30000;
// QTest::newRow("20000, trim") << 20000 << 20000;
// QTest::newRow("30000, no trim") << 30000 << 40000;
// QTest::newRow("30000, trim") << 30000 << 30000;
// QTest::newRow("40000, no trim") << 40000 << 50000;
// QTest::newRow("40000, trim") << 40000 << 40000;
// QTest::newRow("50000, no trim") << 50000 << 60000;
// QTest::newRow("50000, trim") << 50000 << 50000;
// QTest::newRow("60000, no trim") << 60000 << 70000;
// QTest::newRow("60000, trim") << 60000 << 60000;
}
void TestLoggingDirect::benchmarkDB()
{
QFETCH(int, prefill);
QFETCH(int, maxSize);
// setting max log entries to "prefill" to trim it down to what this test needs.
int overflow = 10;
engine.setMaxLogEntries(prefill, overflow);
engine.setMaxLogEntries(maxSize, overflow);
for (int i = engine.logEntries().count(); i < prefill; i++) {
engine.logSystemEvent(QDateTime::currentDateTime(), true);
}
qDebug() << "Starting benchmark with" << engine.logEntries().count() << "entries in the db";
QBENCHMARK {
engine.logSystemEvent(QDateTime::currentDateTime(), true);
}
QDateTime now = QDateTime::currentDateTime();
while (engine.logEntries().count() > maxSize + overflow) {
qApp->processEvents();
if (now.addSecs(5) < QDateTime::currentDateTime()) {
QVERIFY2(false, QString("Housekeeping didn't work. Have %1 entries but expected to have max %2").arg(engine.logEntries().count()).arg(QString::number(maxSize)).toLocal8Bit());
}
}
qDebug() << "Ended benchmark with" << engine.logEntries().count() << "entries in the db";
}
#include "testloggingdirect.moc"
QTEST_MAIN(TestLoggingDirect)