Skip to content

Commit

Permalink
Issue #21 - Remove remaining telemetry structs, callers and flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfbeast committed Apr 2, 2022
1 parent 023a71c commit 534de5c
Show file tree
Hide file tree
Showing 51 changed files with 30 additions and 505 deletions.
53 changes: 0 additions & 53 deletions image/Decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

namespace mozilla {

namespace Telemetry {
enum ID : uint32_t;
} // namespace Telemetry

namespace image {

class imgFrame;
Expand Down Expand Up @@ -57,41 +53,6 @@ struct DecoderFinalStatus final
const bool mShouldReportError : 1;
};

struct DecoderTelemetry final
{
DecoderTelemetry(Maybe<Telemetry::ID> aSpeedHistogram,
size_t aBytesDecoded,
uint32_t aChunkCount,
TimeDuration aDecodeTime)
: mSpeedHistogram(aSpeedHistogram)
, mBytesDecoded(aBytesDecoded)
, mChunkCount(aChunkCount)
, mDecodeTime(aDecodeTime)
{ }

/// @return our decoder's speed, in KBps.
int32_t Speed() const
{
return mBytesDecoded / (1024 * mDecodeTime.ToSeconds());
}

/// @return our decoder's decode time, in microseconds.
int32_t DecodeTimeMicros() { return mDecodeTime.ToMicroseconds(); }

/// The per-image-format telemetry ID for recording our decoder's speed, or
/// Nothing() if we don't record speed telemetry for this kind of decoder.
const Maybe<Telemetry::ID> mSpeedHistogram;

/// The number of bytes of input our decoder processed.
const size_t mBytesDecoded;

/// The number of chunks our decoder's input was divided into.
const uint32_t mChunkCount;

/// The amount of time our decoder spent inside DoDecode().
const TimeDuration mDecodeTime;
};

class Decoder
{
public:
Expand Down Expand Up @@ -359,9 +320,6 @@ class Decoder
/// @return the metadata we collected about this image while decoding.
const ImageMetadata& GetImageMetadata() { return mImageMetadata; }

/// @return performance telemetry we collected while decoding.
DecoderTelemetry Telemetry() const;

/**
* @return a weak pointer to the image associated with this decoder. Illegal
* to call if this decoder is not associated with an image.
Expand All @@ -383,7 +341,6 @@ class Decoder


protected:
friend class AutoRecordDecoderTelemetry;
friend class nsICODecoder;
friend class PalettedSurfaceSink;
friend class SurfaceSink;
Expand All @@ -405,13 +362,6 @@ class Decoder
virtual nsresult FinishInternal();
virtual nsresult FinishWithErrorInternal();

/**
* @return the per-image-format telemetry ID for recording this decoder's
* speed, or Nothing() if we don't record speed telemetry for this kind of
* decoder.
*/
virtual Maybe<Telemetry::ID> SpeedHistogram() const { return Nothing(); }


/*
* Progress notifications.
Expand Down Expand Up @@ -534,9 +484,6 @@ class Decoder
gfx::IntRect mFirstFrameRefreshArea; // The area of the image that needs to
// be invalidated when the animation loops.

// Telemetry data for this decoder.
TimeDuration mDecodeTime;

DecoderFlags mDecoderFlags;
SurfaceFlags mSurfaceFlags;

Expand Down
4 changes: 1 addition & 3 deletions image/RasterImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ namespace image {

class Decoder;
struct DecoderFinalStatus;
struct DecoderTelemetry;
class ImageMetadata;
class SourceBuffer;

Expand Down Expand Up @@ -205,14 +204,13 @@ class RasterImage final : public ImageResource

/**
* Records decoding results, sends out any final notifications, updates the
* state of this image, and records telemetry.
* state of this image.
*
* Main-thread only.
*
* @param aStatus Final status information about the decoder. (Whether it
* encountered an error, etc.)
* @param aMetadata Metadata about this image that the decoder gathered.
* @param aTelemetry Telemetry data about the decoder.
* @param aProgress Any final progress notifications to send.
* @param aInvalidRect Any final invalidation rect to send.
* @param aFrameCount If Some(), a final updated count of the number of frames
Expand Down
3 changes: 0 additions & 3 deletions js/xpconnect/idl/xpccomponents.idl
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,6 @@ interface nsIXPCComponents_Utils : nsISupports
*/
PRTime getWatchdogTimestamp(in AString aCategory);

[implicit_jscontext]
jsval getJSEngineTelemetryValue();

/*
* Clone an object into a scope.
* The 3rd argument is an optional options object:
Expand Down
23 changes: 0 additions & 23 deletions js/xpconnect/src/XPCComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3193,29 +3193,6 @@ nsXPCComponents_Utils::GetWatchdogTimestamp(const nsAString& aCategory, PRTime*
return NS_OK;
}

NS_IMETHODIMP
nsXPCComponents_Utils::GetJSEngineTelemetryValue(JSContext* cx, MutableHandleValue rval)
{
RootedObject obj(cx, JS_NewPlainObject(cx));
if (!obj)
return NS_ERROR_OUT_OF_MEMORY;

unsigned attrs = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;

size_t i = JS_SetProtoCalled(cx);
RootedValue v(cx, DoubleValue(i));
if (!JS_DefineProperty(cx, obj, "setProto", v, attrs))
return NS_ERROR_OUT_OF_MEMORY;

i = JS_GetCustomIteratorCount(cx);
v.setDouble(i);
if (!JS_DefineProperty(cx, obj, "customIter", v, attrs))
return NS_ERROR_OUT_OF_MEMORY;

rval.setObject(*obj);
return NS_OK;
}

bool
xpc::CloneInto(JSContext* aCx, HandleValue aValue, HandleValue aScope,
HandleValue aOptions, MutableHandleValue aCloned)
Expand Down
6 changes: 0 additions & 6 deletions js/xpconnect/src/XPCShellImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,11 +1229,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)

mozilla::LogModule::Init();

// A initializer to initialize histogram collection
// used by telemetry.
UniquePtr<base::StatisticsRecorder> telStats =
MakeUnique<base::StatisticsRecorder>();

if (PR_GetEnv("MOZ_CHAOSMODE")) {
ChaosFeature feature = ChaosFeature::Any;
long featureInt = strtol(PR_GetEnv("MOZ_CHAOSMODE"), nullptr, 16);
Expand Down Expand Up @@ -1528,7 +1523,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
bogus = nullptr;
#endif

telStats = nullptr;
appDir = nullptr;
appFile = nullptr;
dirprovider.ClearGREDirs();
Expand Down
6 changes: 3 additions & 3 deletions js/xpconnect/src/XPCWrappedNativeJSOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,9 @@ const js::ObjectOps XPC_WN_ObjectOpsWithEnumerate = {
// |this| object for a given method (often to the detriment of proper
// call/apply). When these tricks were removed, a fair amount of chrome
// code broke, because it was relying on being able to grab methods off
// some XPCOM object (like the nsITelemetry service) and invoke them without
// a proper |this|. So, if it's quite clear that we're in this situation and
// about to use a |this| argument that just won't work, fix things up.
// some XPCOM object and invoke them without a proper |this|. So, if it's
// quite clear that we're in this situation and about to use a |this|
// argument that just won't work, fix things up.
//
// This hack is only useful for getters/setters if someone sets an XPCOM object
// as the prototype for a vanilla JS object and expects the XPCOM attributes to
Expand Down
9 changes: 0 additions & 9 deletions layout/tools/reftest/reftest-preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ user_pref("dom.allow_XUL_XBL_for_file", true);
// their protocol with the inner URI of the view-source URI
user_pref("security.view-source.reachable-from-inner-protocol", true);

// Ensure that telemetry is disabled, so we don't connect to the telemetry
// server in the middle of the tests.
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.unified", false);
// Likewise for safebrowsing.
user_pref("browser.safebrowsing.phishing.enabled", false);
user_pref("browser.safebrowsing.malware.enabled", false);
user_pref("browser.safebrowsing.forbiddenURIs.enabled", false);
user_pref("browser.safebrowsing.blockedURIs.enabled", false);
// Likewise for tracking protection.
user_pref("privacy.trackingprotection.enabled", false);
user_pref("privacy.trackingprotection.pbmode.enabled", false);
Expand Down
11 changes: 0 additions & 11 deletions mailnews/db/gloda/modules/datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,17 +1030,6 @@ var GlodaDatastore = {

var dbConnection;

// Report about the size of the database through telemetry (if there's a
// database, naturally).
if (dbFile.exists()) {
try {
let h = Services.telemetry.getHistogramById("THUNDERBIRD_GLODA_SIZE_MB");
h.add(dbFile.fileSize/1048576);
} catch (e) {
this._log.warn("Couldn't report telemetry", e);
}
}

// Create the file if it does not exist
if (!dbFile.exists()) {
this._log.debug("Creating database because it doesn't exist.");
Expand Down
19 changes: 0 additions & 19 deletions mailnews/db/gloda/modules/indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,10 +1006,6 @@ var GlodaIndexer = {
// make ourselves less responsive by drawing out the period of time we
// are dominating the main thread.
this._perfIndexStopwatch.start();
// For telemetry purposes, we want to know how many messages we've been
// processing during that batch, and how long it took, pauses included.
let t0 = Date.now();
this._indexedMessageCount = 0;
batchCount = 0;
while (batchCount < this._indexTokens) {
if ((this._callbackHandle.activeIterator === null) &&
Expand Down Expand Up @@ -1150,21 +1146,6 @@ var GlodaIndexer = {
}
}

// All pauses have been taken, how effective were we? Report!
// XXX: there's possibly a lot of fluctuation since we go through here
// every 5 messages or even less
if (this._indexedMessageCount > 0) {
let delta = (Date.now() - t0)/1000; // in seconds
let v = Math.round(this._indexedMessageCount/delta);
try {
let h = Services.telemetry
.getHistogramById("THUNDERBIRD_INDEXING_RATE_MSG_PER_S");
h.add(v);
} catch (e) {
this._log.warn("Couldn't report telemetry", e, v);
}
}

if (batchCount > 0) {
let totalTime = this._perfIndexStopwatch.realTimeSeconds * 1000;
let timePerToken = totalTime / batchCount;
Expand Down
4 changes: 2 additions & 2 deletions mailnews/local/src/nsPop3Sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,13 @@ nsresult nsPop3Sink::WriteLineToMailbox(const nsACString& buffer)
nsString folderName;
if (localFolder)
localFolder->GetPrettiestName(folderName);
// This merits a console message, it's poor man's telemetry.
// This merits a console message.
MsgLogToConsole4(
NS_LITERAL_STRING("Unexpected file position change detected") +
(folderName.IsEmpty() ? EmptyString() : NS_LITERAL_STRING(" in folder ")) +
(folderName.IsEmpty() ? EmptyString() : folderName) + NS_LITERAL_STRING(". "
"If you can reliably reproduce this, please report the steps "
"you used to [email protected] or to bug 1308335 at bugzilla.mozilla.org. "
"you used to the application maintainer. "
"Resolving this problem will allow speeding up message downloads."),
NS_LITERAL_STRING(__FILE__), __LINE__, nsIScriptError::errorFlag);
#ifdef DEBUG
Expand Down
25 changes: 0 additions & 25 deletions modules/libpref/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ static nsresult pref_InitInitialObjects(void);
static nsresult pref_LoadPrefsInDirList(const char *listId);
static nsresult ReadExtensionPrefs(nsIFile *aFile);

static const char kTelemetryPref[] = "toolkit.telemetry.enabled";
static const char kOldTelemetryPref[] = "toolkit.telemetry.enabledPreRelease";
static const char kChannelPref[] = "app.update.channel";

static const char kPrefFileHeader[] =
Expand Down Expand Up @@ -644,12 +642,6 @@ Preferences::ReadUserPrefs(nsIFile *aFile)
// Ignore all errors related to it, so we retain 'rv' value :-|
(void) UseUserPrefFile();

// Migrate the old prerelease telemetry pref
if (!Preferences::GetBool(kOldTelemetryPref, true)) {
Preferences::SetBool(kTelemetryPref, false);
Preferences::ClearUser(kOldTelemetryPref);
}

NotifyServiceObservers(NS_PREFSERVICE_READ_TOPIC_ID);
} else {
rv = ReadAndOwnUserPrefFile(aFile);
Expand Down Expand Up @@ -1336,23 +1328,6 @@ static nsresult pref_InitInitialObjects()
rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
NS_ENSURE_SUCCESS(rv, rv);

// Set up the correct default for toolkit.telemetry.enabled.
// If this build has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta
// channel, telemetry is on by default, otherwise not. This is necessary
// so that beta users who are testing final release builds don't flipflop
// defaults.
if (Preferences::GetDefaultType(kTelemetryPref) == nsIPrefBranch::PREF_INVALID) {
bool prerelease = false;
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
prerelease = true;
#else
if (Preferences::GetDefaultCString(kChannelPref).EqualsLiteral("beta")) {
prerelease = true;
}
#endif
PREF_SetBoolPref(kTelemetryPref, prerelease, true);
}

NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
nullptr, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);

Expand Down
6 changes: 0 additions & 6 deletions modules/libpref/goanna.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
#include ../../netwerk/base/security-prefs.js
#include init/all.js
#ifdef MOZ_DATA_REPORTING
#include ../../toolkit/components/telemetry/datareporting-prefs.js
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
#include ../../toolkit/components/telemetry/healthreport-prefs.js
#endif
16 changes: 0 additions & 16 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,19 +894,6 @@ pref("toolkit.scrollbox.verticalScrollDistance", 3);
pref("toolkit.scrollbox.horizontalScrollDistance", 5);
pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);

// Telemetry settings.
// Server to submit telemetry pings to.
pref("toolkit.telemetry.server", "");
// Telemetry server owner. Please change if you set toolkit.telemetry.server to a different server
pref("toolkit.telemetry.server_owner", "");
// Information page about telemetry (temporary ; will be about:telemetry in the end)
pref("toolkit.telemetry.infoURL", "");
// Determines whether full SQL strings are returned when they might contain sensitive info
// i.e. dynamically constructed SQL strings or SQL executed by addons against addon DBs
pref("toolkit.telemetry.debugSlowSql", false);
// Whether to use the unified telemetry behavior, requires a restart.
pref("toolkit.telemetry.unified", false);

// Identity module
pref("toolkit.identity.enabled", false);
pref("toolkit.identity.debug", false);
Expand Down Expand Up @@ -982,9 +969,6 @@ pref("devtools.gcli.imgurUploadURL", "https://api.imgur.com/3/image");
// GCLI commands directory
pref("devtools.commands.dir", "");

// Allows setting the performance marks for which telemetry metrics will be recorded.
pref("devtools.telemetry.supported_performance_marks", "contentInteractive,navigationInteractive,navigationLoaded,visuallyLoaded,fullyLoaded,mediaEnumerated,scanEnd");

// Deprecation warnings after DevTools file migration.
pref("devtools.migration.warnings", true);

Expand Down
3 changes: 1 addition & 2 deletions mozglue/misc/TimeStamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ TimeStamp::ProcessCreation(bool& aIsInconsistent)

if ((ts > sInitOnce.mFirstTimeStamp) || (uptime == 0)) {
/* If the process creation timestamp was inconsistent replace it with
* the first one instead and notify that a telemetry error was
* detected. */
* the first one instead. */
aIsInconsistent = true;
ts = sInitOnce.mFirstTimeStamp;
}
Expand Down
7 changes: 0 additions & 7 deletions netwerk/base/Predictor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,6 @@ Predictor::GetParallelSpeculativeConnectLimit(
return NS_OK;
}

NS_IMETHODIMP
Predictor::GetIsFromPredictor(bool *isFromPredictor)
{
*isFromPredictor = true;
return NS_OK;
}

NS_IMETHODIMP
Predictor::GetAllow1918(bool *allow1918)
{
Expand Down
Loading

0 comments on commit 534de5c

Please sign in to comment.