Commit Graph

128 Commits

Author SHA1 Message Date
Alessio Placitelli
fc30d25532 Bug 1468809 - Do not snapshot expired keyed histograms. r=chutten,janerik
This patch changes the snapshotting code for keyed histograms
so that requesting a snapshot does not report expired histograms.

MozReview-Commit-ID: GDiw6yOcF8J
2018-06-15 19:31:26 +02:00
Emilio Cobos Álvarez
4b8b5e1717 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Michael Calabrese
571c070dff Bug 1362953 - Require lock proof in TelemetryHistogram internal functions where possible. r=Dexter
MozReview-Commit-ID: JOr3Q2z965R
2018-05-22 23:40:37 -04:00
Rofael Aleezada
b0e14e7b1b Bug 806514 - Replaced std::vector with nsTArray in Histogram::SampleSet. r=chutten
MozReview-Commit-ID: 6ptwiOz2c5i
2018-05-23 21:50:29 -05:00
Alessio Placitelli
17a1884f63 Bug 1459144 - Add gtest coverage for GeckoView measurements' persistence. r=janerik
This patch changes GeckoView persistence code so that it will always get compiled
and linked to the final executable, even outside of Android. By doing so, we are
able to easily add gtest coverage for this code on all platforms other than Android
on which gtest is not yet supported.
In addition to that, this patch adds proper test cases for measurements' serialization
and deserialization for both scalars and histograms.

MozReview-Commit-ID: J0Snhl3Y8jk
2018-05-22 17:15:33 +02:00
Alessio Placitelli
e25cf75780 Bug 1459144 - Allocate enough memory for all the processes when deserializing histograms. r=chutten
This is needed as we might end up serializing only one process, but its id might
be greater than 1 when deserializing.

MozReview-Commit-ID: EzXOOhlNV1Y
2018-05-22 17:12:59 +02:00
Alessio Placitelli
0f6debe222 Bug 1457127 - Implement keyed histogram persistence for GeckoView. r=chutten,janerik
MozReview-Commit-ID: 8eyXlu9R6jC
2018-05-16 13:09:33 +02:00
Alessio Placitelli
267cb14feb Bug 1457127 - Implement histogram persistence for GeckoView. r=chutten,janerik
This patch implements the serialization and deserialization functions for
plain histograms.

MozReview-Commit-ID: GmnUD0xP8iI
2018-05-16 13:09:33 +02:00
Alessio Placitelli
f8bccbe472 Bug 1457127 - Add an helper function for checking if the GPU process was used. r=janerik
MozReview-Commit-ID: 1xcrk1sCXHE
2018-05-17 08:56:16 +02:00
Alessio Placitelli
56c60b0cae Bug 1457127 - Do not reflect histograms that are not for the current product. r=chutten,janerik
This ensures that histograms that are not allowed on a product will not
be present in a snapshot. This is mainly to work around the fact that
legacy flag histograms are always reported, even if they are not set.

MozReview-Commit-ID: EyR6KhjPC4o
2018-05-16 13:09:33 +02:00
Alessio Placitelli
0f8e4e8dd3 Bug 1457127 - Remove unused reflectStatus. r=janerik
MozReview-Commit-ID: 6AwQTnDFjzG
2018-05-16 13:09:33 +02:00
Alessio Placitelli
94e53a6763 Bug 1457127 - Create common helpers for taking keyed histogram snapshots. r=chutten,janerik
MozReview-Commit-ID: 3JrMtOrefdS
2018-05-16 13:09:33 +02:00
Alessio Placitelli
da264ee6cd Bug 1457127 - Create common helpers for taking histogram snapshots. r=chutten,janerik
This patch factors out the code needed to take snapshots for plain
histograms. These functions will be used for generating a snapshot
for the persistence logic as well.

MozReview-Commit-ID: 37kx3WidlhJ
2018-05-16 13:09:33 +02:00
Alessio Placitelli
1e2bf8d0ab Bug 1430531 - Refactor JS exposed keyed snapshotting to avoid races and deadlocks. r=chutten
This patch makes sure that snapshotting is performed while
holding the histogram mutex. JS reflection code is only called
after the snapshot is taken, outside of the locked section.

MozReview-Commit-ID: H1uJz1H7rIu
2018-05-11 13:57:50 +02:00
Alessio Placitelli
f139862d58 Bug 1430531 - Refactor histogram code to allow for JS-free snapshotting. r=chutten
This patch introduces a couple of new functions to copy histogram data
to Mozilla-friendly arrays. This solves the problem of passing Histogram
pointers around and makes working away from JS functions easier.

MozReview-Commit-ID: BIg3FXBzxfT
2018-05-14 14:09:47 +02:00
Jan-Erik Rediger
90310faec0 Bug 1320052 - Unify histogram storage into a single container. r=chutten
On Desktop and GeckoView we only ever need to store histograms for a
subsession and clear the histograms when a snapshot is done (e.g. a main ping is built).
On Fennec we don't have subsessions and only store for a session and never clear the storage.

MozReview-Commit-ID: BeVi86kZPs2
2018-05-02 15:43:02 +02:00
arthur.iakab
043600c175 Backed out 6 changesets (bug 1320052) on request by Dexter for requently failing test verify dom/base/test/browser_use_counters.js
Backed out changeset 07db52945b1f (bug 1320052)
Backed out changeset 7a64a23bf183 (bug 1320052)
Backed out changeset c95a4b0c6642 (bug 1320052)
Backed out changeset 4749633bd02f (bug 1320052)
Backed out changeset c7b8f6d55a0b (bug 1320052)
Backed out changeset b0396db0229c (bug 1320052)
2018-05-08 17:38:29 +03:00
Jan-Erik Rediger
576acd90f7 Bug 1320052 - Unify histogram storage into a single container. r=chutten
On Desktop and GeckoView we only ever need to store histograms for a
subsession and clear the histograms when a snapshot is done (e.g. a main ping is built).
On Fennec we don't have subsessions and only store for a session and never clear the storage.

MozReview-Commit-ID: BeVi86kZPs2
2018-05-02 15:43:02 +02:00
Jan-Erik Rediger
c5f48e2625 Bug 1452552 - Add "products" property to histograms. r=Dexter
The "products" property is optional and defaults to `firefox, fennec`.
Recording of histograms is disabled if the probe doesn't have the products
property for the current running product.

MozReview-Commit-ID: 3puMXbuicuC
2018-04-23 12:58:51 +02:00
Aditya Bharti
248ebc9f2d bug 1442664 - JSKeyedHistogram_Add accumulates multiple samples in one call r=chutten
Factored out common code between JSHistogram_Add and JSKeyedHistogram_Add
to get values from array, and handle case of single accumulation.
Uses type checking utility function introduced in bug 1428893.
2018-04-23 04:43:34 +05:30
Tom Schuster
6698b9aad3 Bug 1255800 - Remove JS_THIS_OBJECT from dom/xpconnect. r=bz 2018-03-07 14:35:22 +01:00
Aditya Bharti
4c45e24322 Bug 1442667 - Refactor internal_JSKeyedHistogram_Add r=chutten
Use the type checking utility function introduced in bug 1428893
Added more tests to increase code coveragea and ensure no regressions
2018-03-24 10:29:29 +05:30
Nathan Froyd
8b87608a7f Bug 1443587 - part 5 - more efficient string serialization; r=chutten
The code for serializing an EventKey in SerializeEventsArray does
something peculiar: it creates a temporary array of nsCStrings, copies
the appropriate strings from the event info for the key, and then
converts those into JavaScript strings.  But we shouldn't need to do any
copying into the temporary array.  We can do everything directly on the
strings from the event info themselves.

It seemed best to introduce a ToJSString for this purpose, which comes
in handy in a couple other places as well.
2018-03-07 11:00:44 -05:00
Chris H-C
c719b84365 bug 1440832 - Only log on debug builds when clamping. r=gfritzsche
MozReview-Commit-ID: E7Am8rwmaut
2018-03-02 14:53:41 -05:00
Aditya Bharti
c1c7c6ee3d Bug 1428893 - Allow JSHistogram APIs to accumulate multiple values in one call. r=chutten
This patch adds support for value arrays to the internal_JSHistogram_Add method.

The histogram.add() js method can now be called with a single value or an array of values.
The accumulation is "all-or-nothing", i.e. if there is even a single invalid value in the
array, then nothing is accumulated.

The logic for type checking arguments before accumulation has been moved into a separate
function: internal_JSHistogram_CoerceValue. This function can also be used for
internal_JSKeyedHistogram_* methods in the future. This patch includes logic for clamping
values greater than UINT32_MAX to UINT32_MAX.

Added xpcshell tests in telemetry/tests/unit/test_TelemetryHistograms.js to check functionality.
2018-02-24 02:11:41 +05:30
Chris H-C
2d3474f12f bug 1438335 - Record when we have to clamp large Telemetry accumulations. r=Dexter,francois
We need to clamp accumulations to fit in our data representation (int). This
patch records the number of times, and for which probes, we had to do so.

MozReview-Commit-ID: GSs3oFvLKlL
2018-02-15 16:13:36 -05:00
Chris H-C
39cedb8089 bug 1438335 - Clamp the samples accumulated to histograms. r=Dexter
Internally Histograms use int, which is signed.

Our API uses uint32_t, which is not.

Our JS API uses ToUint32, which takes provided values modulo UINT32_MAX.

This patch consolidates behaviour so that all values greater than INT_MAX will
be correctly recorded in the highest bucket of a Histogram... instead of
having values between INT_MAX and UINT32_MAX end up as 0s, and values above
UINT32_MAX being taken modulo UINT32_MAX, but only from the JS API.

MozReview-Commit-ID: CzaaNZkPEji
2018-02-15 13:32:13 -05:00
Andrew McCreight
c509a522ed Bug 1437689 - Add basic memory reporting for gNameToHistogramIDMap. r=gfritzsche
MozReview-Commit-ID: 8QGudRuXmWh
2018-02-12 14:24:03 -08:00
Aditya Bharti
4b0c63ce5b Bug 1428888 - Allow C++ to accumulate multiple samples into a categorical histogram in one call r=chutten
Telemetry::Accumulate now supports two new signatures: Accumulate(HistogramId, nsTArray stringLabels) and
Accumulate(nsTArray enumValues). In the stringLabels case, if the array contains an invalid label, then no
samples are accumulated at all. In the enumValues array case, the class template ensures that we do not have
a mismatch of labels in the array, since the enumValues class is tied to the id of the histogram we want to
accumulate to.
2018-01-28 16:53:40 +05:30
Chris H-C
695225d7e0 bug 1432855 - Early-return if we're asked to clear the expired histogram. r=gfritzsche
MozReview-Commit-ID: IH4BCDq8fgz
2018-01-25 14:05:05 -05:00
Eric Rahm
4a23f36203 Bug 1428612 - Part 2: Add an assertion to check the histogram name pointer. r=gfritzsche
This adds a dignostic assertion that the name pointer is actually within the
static name table.
2018-01-17 16:52:37 -08:00
Eric Rahm
741514933e Bug 1428612 - Part 1: Use nsLiteralCString to wrap histogram names. r=gfritzsche
This switches from `nsDependentCString` to `nsLiteralCString` when adding
histograms to the table. It will help save some memory and should avoid the OOM
smalls we have been seeing.
2018-01-17 16:38:18 -08:00
fernando
0d775bcfde Bug 1278821 - Re-factor JS-exposed functions in TelemetryHistogram.cpp to avoid deadlocks. r=Dexter 2018-01-11 22:01:15 +00:00
Aditya Bharti
bfc368ad56 bug 1428885 - Allow C++ to accumulate multiple samples into a keyed histogram in one call r=chutten
Extended the Telemetry::Accumulate API to take a Histogram ID, string key, and a nsTArray<uint32_t> of samples.
Test cases check for linear, count and histograms with a set of allowed keys. Made changes to fix try failures.
2018-01-12 03:26:04 +05:30
Aditya Bharti
4cfa0ad19f bug 1364043 - Allow C++ to accumulate multiple samples into histograms with one call. r=chutten
Added another Telemetry::Accumulate function that takes a histogram id and an array of samples as arguments.
As of this patch, adding multiple samples to keyed and categorical histograms is not supported.
2018-01-09 02:16:30 +05:30
FSeita
bc9e6fa603 Bug 1376333 - Improve naming of accumulation types & variables r=Dexter
MozReview-Commit-ID: F9w7CLUOP6r
2017-09-13 11:20:36 +02:00
Doug Thayer
297ca9d1d7 Bug 1397376 - Avoid copying on initializing histogram ranges r=gfritzsche
Since LinearHistogram and its descendants inherit ranges_ from
Histogram, and we wanted to replace the copying into a std::vec
for Histogram, the simplest approach seemed to just be to
precompute ranges for all histograms, exponential or otherwise.
This should have the added benefit of reducing the memory
footprint for those histograms, since they will benefit from the
deduplication work that the precomputing script already does.

MozReview-Commit-ID: JTV5Dej5ZIb
2017-09-08 12:13:44 -07:00
Chris H-C
97ba53dc5e bug 1373240 - Use somewhat-more-dynamically-allocated histogram storage r=Dexter,gfritzsche
Switch from static multi-dimensional arrays to dynamic one-dimensional arrays
that are only allocated in the parent process.

MozReview-Commit-ID: tyGEFhU2Fq
2017-08-29 15:05:35 -04:00
Sebastian Hengst
656ad5ff03 Backed out changeset 0181bf16af4f (bug 1373240) for leaks detected by asan. r=backout 2017-09-08 16:47:04 +02:00
Chris H-C
3dddcf48de bug 1373240 - Use somewhat-more-dynamically-allocated histogram storage r=Dexter,gfritzsche
Switch from static multi-dimensional arrays to dynamic one-dimensional arrays
that are only allocated in the parent process.

MozReview-Commit-ID: tyGEFhU2Fq
2017-08-29 15:05:35 -04:00
Chris H-C
eabcba7afb bug 1376600 - Remove registered(Keyed)Histograms r=Dexter
With the removal of the old addonHistograms, all histograms are now registered.
So removing registered(Keyed)Histograms should be straightforward?

Unfortunately not, as this was how we filtered data based on dataset
(opt-in/opt-out), so a little more fiddling was needed to get C++ to only
serialize dataset-appropriate data (instead of post-facto filtering it in JS).

MozReview-Commit-ID: HDplhmzmzJl
2017-08-22 09:42:09 -04:00
Jan de Mooij
f9f0443c9f Bug 1389510 part 3 - Remove getProperty/setProperty hooks from ClassOps. r=evilpie 2017-08-25 10:12:16 +02:00
Alessio Placitelli
5329b408e3 Bug 1343855 - Part 2 - Add support for key whitelists in keyed histograms. r=gfritzsche, data-review=francois
MozReview-Commit-ID: H2pE3VivWIX
2017-05-17 04:10:00 +02:00
Doug Thayer
b419dc7f86 Bug 1383210 - Use precomputed histogram buckets r=gfritzsche
The log and exp calls in base::Histogram::InitializeBucketRange()
were showing up in profiles. This patch uses the precomputed
buckets for exponential histograms instead of computing them at
runtime. Though linear histograms do show up in the profile that
prompted this change, they contribute much less, and due to the
trivial nature of generating these, it's unlikely that a static
cache would provide much if any speedup.

MozReview-Commit-ID: IavFwoWjFhk
2017-08-04 10:02:28 -07:00
Wes Kocher
5f9ee65672 Backed out changeset 277c7e4952a8 (bug 1383210) for flake8 failures a=backout
MozReview-Commit-ID: 3j1ROBxjf2Z
2017-08-08 12:38:41 -07:00
Doug Thayer
da71c2e874 Bug 1383210 - Use precomputed histogram buckets r=gfritzsche
The log and exp calls in base::Histogram::InitializeBucketRange()
were showing up in profiles. This patch uses the precomputed
buckets for exponential histograms instead of computing them at
runtime. Though linear histograms do show up in the profile that
prompted this change, they contribute much less, and due to the
trivial nature of generating these, it's unlikely that a static
cache would provide much if any speedup.

MozReview-Commit-ID: IavFwoWjFhk
2017-08-04 10:02:28 -07:00
Dean
deb71c0ef5 Bug 1381470 - Added a less memory consuming method to tell if a histogram is empty. r=chutten 2017-07-31 21:38:48 +02:00
Chris H-C
bb4cb30677 bug 1366294 - Part 12 - Clean up after onesself. r=gfritzsche
Without the StatisticsRecorder cleaning up after us we need to now manually
delete the Histograms we create.

MozReview-Commit-ID: 8jrPPBQmU0Z
2017-07-24 09:52:26 -04:00
Chris H-C
f0f263244d bug 1366294 - Part 10 - Nail down count histogram semantics. r=gfritzsche
Previously we assumed count histograms were always present in payloads.
This was an erroneous assumption as count histograms were only 0 if they were
session histograms, or if they were from subsession histograms from subsessions
_after_ a subsession when they held a non-0 value.

So let's just treat count histograms as normal histograms from now on, without
any of this "sometimes 0" nonsense. This simplifies the code, tests, and our
understanding... and _should_ have few/zero downstream effects since the
existing behaviour was so poorly-understood (though exactly tested).

MozReview-Commit-ID: BH108ksygGw
2017-07-24 09:52:26 -04:00
Chris H-C
43ee3b33fc bug 1366294 - Part 7 - Use keyed histogram snaphots to build payloads. r=gfritzsche
TelemetrySession's getKeyedHistograms asks for each keyed histogram
individually. This is inefficient and doesn't work well with the storage
refactor.

So, plumb through a subsession keyed histogram snapshot API and convert
TelemetrySession over to using it.

MozReview-Commit-ID: Af9dTqw99UA
2017-07-24 09:52:26 -04:00