QuantifiedSelf icon indicating copy to clipboard operation
QuantifiedSelf copied to clipboard

ChromeTabs

Open senfi opened this issue 12 years ago • 8 comments

I am pretty sure, that there is a better way to count Chrome Tabs

I used a Chrome Extension that was able to display the number of opened tabs in all Chrome windows. it should be easy to rewrite this tool to write to a file, every time the number of tabs changes.

If you are interested in this kind of chrome-extension (at least i am), i would take care of this in the next days...

senfi avatar Feb 13 '14 08:02 senfi

TL;DR: Do it!

I also have an extension installed which displays the open tabs (»Tab Count«). That's where I synchronized the ps-output with, as it was easier than counting tabs. I don't know anything about writing Chrome plugins, to this was out of the picture for me.

Why do you think this is better? Getting the psutil output is quite good, I think.

Creating a file with the amount of tabs would still need a 'translator' to put that information into a database (you could, of course, post the information from the plugin directly into a sqlite db). Also, counting not every five minutes but only when something changes, leads to some different data. They should be 1:1 transferable, of course, so for new data sets this should be fine. But for me, having data of a few months already, that would be severe cut. Not too important, though.

So, the only question remains: Why do you think, a Chrome plugin is better suited?

AndiH avatar Feb 13 '14 08:02 AndiH

Using a Chrome plugin would give instant feedback of the tab count. But i agree that this is a problem, if you have got a huge amount of data already collected. Only plotting changes in tab count would result in gaps between data points while plotting. But this also happens, if you turn off your mac and ps isnt able to count anymore. How do you handle this case?

senfi avatar Feb 13 '14 09:02 senfi

But PS also gives instant feedback! An upside I see with using an extension for this is that it can (maybe?) easier be done also for other browsers, e.g. Firefox… Maybe at least?

The »problem« is only a problem for people already using this. Which should be only me. So, not to much of a problem. Gaps in data series are just »no changes«. At the moment I'm handling off-time not at all, as I have not yet made a tab count evaluation which was more sophisticated than plotting all data points ;). But translating between (every 5 minutes) and (every time the tab count changes) is just another small script, which should be no problem.

Btw: When closing 20 tabs at once, directly after another, this would lead to 20 distinct data points… so maybe there should be a minimum of 30 seconds between each tab count saving?

AndiH avatar Feb 13 '14 09:02 AndiH

One could also implement something like: Save changes every 30 seconds (if there are any) and save the absolute amount every hour/day/whatever to include some redundancy as a cross-check.

Nepomuk avatar Feb 13 '14 10:02 Nepomuk

I'm against that. You would need to respect that in every evaluation you do. Also, I don't think you need that kind of redundancy…

AndiH avatar Feb 13 '14 10:02 AndiH

Alternatively: take the changes reported from the plugin and calculate the absolute value with the last database entry. That way you cannot mess up the absolute count. And the amount of data is the same (because in both cases 32-bit integers are saved).

Nepomuk avatar Feb 13 '14 10:02 Nepomuk

Why would you mess up the absolute count? The extension still writes absolute values into the database. The only difference to how it's done at the moment: Not every five minutes, but when there's a change in the tab count.

AndiH avatar Feb 13 '14 10:02 AndiH

Ah sorry, I got that you wanted to save the difference in open tabs (like +1, -2) in the database. This would fail if just one entry is flawed.

Nepomuk avatar Feb 13 '14 10:02 Nepomuk