You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello,
take this with a grain of salt until someone can confirm because I am not extensively familiar with this project.
I've been noticing some discrepancies in our NetUsage - App Data outputs and did some cursory review of the relevant code to see if I could figure out why. I noticed that netusage.py is using the following SQL query:
select
datetime(ZLIVEUSAGE.ZTIMESTAMP+978307200,'unixepoch'),
datetime(ZPROCESS.ZFIRSTTIMESTAMP+978307200,'unixepoch'),
datetime(ZPROCESS.ZTIMESTAMP+978307200,'unixepoch'),
ZPROCESS.ZBUNDLENAME,
ZPROCESS.ZPROCNAME,
case ZLIVEUSAGE.ZKIND
when 0 then 'Process'
when 1 then 'App'
end,
ZLIVEUSAGE.ZWIFIIN,
ZLIVEUSAGE.ZWIFIOUT,
ZLIVEUSAGE.ZWWANIN,
ZLIVEUSAGE.ZWWANOUT,
ZLIVEUSAGE.ZWIREDIN,
ZLIVEUSAGE.ZWIREDOUTfrom ZLIVEUSAGE
left join ZPROCESS onZPROCESS.Z_PK=ZLIVEUSAGE.Z_PK
I believe that this is incorrect, specifically the final line which is comparing primary keys from ZPROCESS and ZLIVEUSAGE. this is apparently resulting in missing and/or incorrect data in the output.
based on the layout of the netusage.sqlite db, I believe the correct query should be as follows:
select
datetime(ZLIVEUSAGE.ZTIMESTAMP+978307200,'unixepoch'),
datetime(ZPROCESS.ZFIRSTTIMESTAMP+978307200,'unixepoch'),
datetime(ZPROCESS.ZTIMESTAMP+978307200,'unixepoch'),
ZPROCESS.ZBUNDLENAME,
ZPROCESS.ZPROCNAME,
case ZLIVEUSAGE.ZKIND
when 0 then 'Process'
when 1 then 'App'
end,
ZLIVEUSAGE.ZWIFIIN,
ZLIVEUSAGE.ZWIFIOUT,
ZLIVEUSAGE.ZWWANIN,
ZLIVEUSAGE.ZWWANOUT,
ZLIVEUSAGE.ZWIREDIN,
ZLIVEUSAGE.ZWIREDOUTfrom ZLIVEUSAGE
left join ZPROCESS onZPROCESS.Z_PK=ZLIVEUSAGE.ZHASPROCESS
where the LEFT JOIN instead evaluates ZHASPROCESS from ZLIVEUSAGE against the primary key from ZPROCESS. using this amended query against the native sqlite db results in a more complete and believable output.
further, I noticed that a query in this format is used in DataUsage.py, but I've confirmed that the NetUsage - App Data output is definitely coming from netusage.py in the v2.0.4 binary release.
thank you for creating and maintaining this project and TIA for any time spent looking into this. if I am wrong, please do let me know.
The text was updated successfully, but these errors were encountered:
@gja3 I will look into it, I believe I might have made the Netusage parser, I definitely did the DataUsage one. Netusage needs updated anyhow for new formatting so I can try and test some queries and see.
hello,
take this with a grain of salt until someone can confirm because I am not extensively familiar with this project.
I've been noticing some discrepancies in our NetUsage - App Data outputs and did some cursory review of the relevant code to see if I could figure out why. I noticed that
netusage.py
is using the following SQL query:I believe that this is incorrect, specifically the final line which is comparing primary keys from
ZPROCESS
andZLIVEUSAGE
. this is apparently resulting in missing and/or incorrect data in the output.based on the layout of the
netusage.sqlite
db, I believe the correct query should be as follows:where the
LEFT JOIN
instead evaluatesZHASPROCESS
fromZLIVEUSAGE
against the primary key fromZPROCESS
. using this amended query against the native sqlite db results in a more complete and believable output.further, I noticed that a query in this format is used in
DataUsage.py
, but I've confirmed that the NetUsage - App Data output is definitely coming fromnetusage.py
in the v2.0.4 binary release.thank you for creating and maintaining this project and TIA for any time spent looking into this. if I am wrong, please do let me know.
The text was updated successfully, but these errors were encountered: