Bug 723925 - Telemetry for number and size of annotations.

r=dietrich
This commit is contained in:
Marco Bonardo 2012-02-07 16:00:55 +01:00
Родитель faa872ff80
Коммит ae33b790f1
3 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -960,7 +960,22 @@ let PlacesDBUtils = {
let placesPageCount = probeValues.PLACES_PAGES_COUNT;
return Math.round((dbPageSize * aDbPageCount) / placesPageCount);
}
}
},
{ histogram: "PLACES_ANNOS_BOOKMARKS_COUNT",
query: "SELECT count(*) FROM moz_items_annos" },
// LENGTH is not a perfect measure, since it returns the number of bytes
// only for BLOBs, the number of chars for anything else. Though it's
// the best approximation we have.
{ histogram: "PLACES_ANNOS_BOOKMARKS_SIZE_KB",
query: "SELECT SUM(LENGTH(content))/1024 FROM moz_items_annos" },
{ histogram: "PLACES_ANNOS_PAGES_COUNT",
query: "SELECT count(*) FROM moz_annos" },
{ histogram: "PLACES_ANNOS_PAGES_SIZE_KB",
query: "SELECT SUM(LENGTH(content))/1024 FROM moz_annos" },
];
let params = {

Просмотреть файл

@ -22,6 +22,10 @@ let histograms = {
//PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS: function (val) do_check_true(val > 1),
PLACES_IDLE_FRECENCY_DECAY_TIME_MS: function (val) do_check_true(val > 0),
PLACES_IDLE_MAINTENANCE_TIME_MS: function (val) do_check_true(val > 0),
PLACES_ANNOS_BOOKMARKS_COUNT: function (val) do_check_eq(val, 1),
PLACES_ANNOS_BOOKMARKS_SIZE_KB: function (val) do_check_eq(val, 1),
PLACES_ANNOS_PAGES_COUNT: function (val) do_check_eq(val, 1),
PLACES_ANNOS_PAGES_SIZE_KB: function (val) do_check_eq(val, 1),
}
function run_test() {
@ -40,6 +44,16 @@ function run_test() {
PlacesUtils.tagging.tagURI(uri, ["tag"]);
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
// Set a large annotation.
let content = "";
while (content.length < 1024) {
content += "0";
}
PlacesUtils.annotations.setItemAnnotation(itemId, "test-anno", content, 0,
PlacesUtils.annotations.EXPIRE_NEVER);
PlacesUtils.annotations.setPageAnnotation(uri, "test-anno", content, 0,
PlacesUtils.annotations.EXPIRE_NEVER);
// Request to gather telemetry data.
Cc["@mozilla.org/places/categoriesStarter;1"]
.getService(Ci.nsIObserver)

Просмотреть файл

@ -289,6 +289,10 @@ HISTOGRAM(PLACES_EXPIRATION_STEPS_TO_CLEAN, 1, 10, 10, LINEAR, "PLACES: Expirati
HISTOGRAM(PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS, 50, 500, 10, EXPONENTIAL, "PLACES: Time for first autocomplete result if > 50ms (ms)")
HISTOGRAM(PLACES_IDLE_FRECENCY_DECAY_TIME_MS, 50, 10000, 10, EXPONENTIAL, "PLACES: Time to decay all frecencies values on idle (ms)")
HISTOGRAM(PLACES_IDLE_MAINTENANCE_TIME_MS, 1000, 30000, 10, EXPONENTIAL, "PLACES: Time to execute maintenance tasks on idle (ms)")
HISTOGRAM(PLACES_ANNOS_BOOKMARKS_COUNT, 50, 5000, 10, EXPONENTIAL, "PLACES: Number of bookmarks annotations")
HISTOGRAM(PLACES_ANNOS_BOOKMARKS_SIZE_KB, 10, 10000, 10, EXPONENTIAL, "PLACES: Size of bookmarks annotations (KB)")
HISTOGRAM(PLACES_ANNOS_PAGES_COUNT, 50, 5000, 10, EXPONENTIAL, "PLACES: Number of pages annotations")
HISTOGRAM(PLACES_ANNOS_PAGES_SIZE_KB, 10, 10000, 10, EXPONENTIAL, "PLACES: Size of pages annotations (KB)")
/**
* Updater telemetry.