SH-4090 Metrics for mesh load time - cleanup after davep review

One of the metrics calls was running in an LLCurl-owned thread
doing responder invocation.  Deleted that invocation and will
do with the other safe ones.  Added a boost signal on the
TeleportStarted message which is now used to restart the metrics
timer.  I think I'd like to move the metric blob into a free-
standing entity later...
master
Monty Brandenberg 2013-04-18 16:23:15 -04:00
parent e59d598782
commit 7911f065cd
1 changed files with 40 additions and 7 deletions

View File

@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2010-2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -52,6 +52,7 @@
#include "llviewercontrol.h"
#include "llviewerinventory.h"
#include "llviewermenufile.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llviewertexturelist.h"
@ -109,7 +110,7 @@ std::string make_dump_name(std::string prefix, S32 num)
void dump_llsd_to_file(const LLSD& content, std::string filename);
LLSD llsd_from_file(std::string filename);
std::string header_lod[] =
const std::string header_lod[] =
{
"lowest_lod",
"low_lod",
@ -117,6 +118,13 @@ std::string header_lod[] =
"high_lod"
};
// Static data and functions to measure mesh load
// time metrics for a new region scene.
static bool metrics_inited(false);
static boost::signals2::connection metrics_teleport_connection;
static unsigned int metrics_teleport_start_count(0);
static void metrics_teleport_started();
//get the number of bytes resident in memory for given volume
U32 get_volume_memory_size(const LLVolume* volume)
{
@ -2168,9 +2176,6 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
if (status < 200 || status > 400)
{
// Manage time-to-load metrics for mesh download operations.
LLMeshRepository::metricsProgress(0);
//llwarns
// << "Header responder failed with status: "
// << status << ": " << reason << llendl;
@ -2310,12 +2315,26 @@ void LLMeshRepository::init()
mThread = new LLMeshRepoThread();
mThread->start();
if (! metrics_inited)
{
// Get teleport started signals to restart timings.
metrics_teleport_connection = LLViewerMessage::getInstance()->
setTeleportStartedCallback(metrics_teleport_started);
metrics_inited = true;
}
}
void LLMeshRepository::shutdown()
{
llinfos << "Shutting down mesh repository." << llendl;
if (metrics_inited)
{
metrics_teleport_connection.disconnect();
metrics_inited = false;
}
for (U32 i = 0; i < mUploads.size(); ++i)
{
llinfos << "Discard the pending mesh uploads " << llendl;
@ -3735,9 +3754,10 @@ void LLMeshRepository::metricsStop()
void LLMeshRepository::metricsProgress(unsigned int this_count)
{
static bool first_start(true);
if (first_start)
{
// Let the first request start the timing cycle for login.
++metrics_teleport_start_count;
metricsStart();
first_start = false;
}
@ -3760,7 +3780,20 @@ void LLMeshRepository::metricsUpdate()
metrics["start"] = started;
metrics["stop"] = stopped;
metrics["downloads"] = LLSD::Integer(total_count);
metrics["teleports"] = LLSD::Integer(metrics_teleport_start_count);
llinfos << "EventMarker " << metrics << llendl;
}
}
// Will use a request to start a teleport as a signal to
// restart a timing sequence. We don't get one of these
// for login so initial start is done above.
//
// Threading: main thread only
// static
void metrics_teleport_started()
{
LLMeshRepository::metricsStart();
++metrics_teleport_start_count;
}