Merge asset-http

meow-7.2.2
Ansariel 2017-03-20 17:13:42 +01:00
commit afef92cafc
8 changed files with 54 additions and 52 deletions

View File

@ -19740,7 +19740,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key>
<string>String</string>
<key>Value</key>
<string />
<string>all</string>
</map>
<key>SimulateFBOFailure</key>

View File

@ -6881,23 +6881,18 @@ void LLAppViewer::metricsSend(bool enable_reporting)
{
std::string caps_url = regionp->getCapability("ViewerMetrics");
LLSD sd = gViewerAssetStats->asLLSD(true);
if (gSavedSettings.getBOOL("QAModeMetrics"))
{
dump_sequential_xml("metric_asset_stats",gViewerAssetStats->asLLSD(true));
dump_sequential_xml("metric_asset_stats",sd);
}
// Make a copy of the main stats to send into another thread.
// Receiving thread takes ownership.
LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats));
main_stats->stop();
// Send a report request into 'thread1' to get the rest of the data
// and provide some additional parameters while here.
LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
gAgentSessionID,
gAgentID,
main_stats);
main_stats = 0; // Ownership transferred
sd);
}
else
{

View File

@ -344,10 +344,12 @@ LLMeshRepository gMeshRepo;
const S32 MESH_HEADER_SIZE = 4096; // Important: assumption is that headers fit in this space
// <FS:Ansariel> [UDP Assets]
const S32 REQUEST_HIGH_WATER_MIN = 32; // Limits for GetMesh regions
const S32 REQUEST_HIGH_WATER_MAX = 150; // Should remain under 2X throttle
const S32 REQUEST_LOW_WATER_MIN = 16;
const S32 REQUEST_LOW_WATER_MAX = 75;
// </FS:Ansariel> [UDP Assets]
const S32 REQUEST2_HIGH_WATER_MIN = 32; // Limits for GetMesh2 regions
const S32 REQUEST2_HIGH_WATER_MAX = 100;

View File

@ -488,7 +488,7 @@ private:
void recordTextureStart(bool is_http);
// Threads: Ttf
void recordTextureDone(bool is_http);
void recordTextureDone(bool is_http, F64 byte_count);
void lockWorkMutex() { mWorkMutex.lock(); }
void unlockWorkMutex() { mWorkMutex.unlock(); }
@ -827,7 +827,7 @@ public:
TFReqSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats);
LLSD& stats_sd);
TFReqSendMetrics & operator=(const TFReqSendMetrics &); // Not defined
virtual ~TFReqSendMetrics();
@ -838,7 +838,7 @@ public:
const std::string mCapsURL;
const LLUUID mSessionID;
const LLUUID mAgentID;
LLViewerAssetStats * mMainStats;
LLSD mStatsSD;
private:
LLCore::HttpHandler::ptr_t mHandler;
@ -1447,6 +1447,13 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
if (processSimulatorPackets())
{
// Capture some measure of total size for metrics
F64 byte_count = 0;
for (S32 i=mFirstPacket; i<=mLastPacket; i++)
{
byte_count += mPackets[i]->mSize;
}
LL_DEBUGS(LOG_TXT) << mID << ": Loaded from Sim. Bytes: " << mFormattedImage->getDataSize() << LL_ENDL;
mFetcher->removeFromNetworkQueue(this, false);
if (mFormattedImage.isNull() || !mFormattedImage->getDataSize())
@ -1464,7 +1471,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
setState(DECODE_IMAGE);
mWriteToCacheState = SHOULD_WRITE;
recordTextureDone(false);
recordTextureDone(false, byte_count);
}
else
{
@ -2114,7 +2122,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe
mFetcher->removeFromHTTPQueue(mID, data_size);
recordTextureDone(true);
recordTextureDone(true, data_size);
} // -Mw
@ -2514,14 +2522,15 @@ void LLTextureFetchWorker::recordTextureStart(bool is_http)
// Threads: Ttf
void LLTextureFetchWorker::recordTextureDone(bool is_http)
void LLTextureFetchWorker::recordTextureDone(bool is_http, F64 byte_count)
{
if (mMetricsStartTime.value())
{
LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_TEXTURE,
is_http,
LLImageBase::TYPE_AVATAR_BAKE == mType,
LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime);
is_http,
LLImageBase::TYPE_AVATAR_BAKE == mType,
LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime,
byte_count);
mMetricsStartTime = (U32Seconds)0;
}
LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE,
@ -3884,9 +3893,9 @@ void LLTextureFetch::commandSetRegion(U64 region_handle)
void LLTextureFetch::commandSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats)
LLSD& stats_sd)
{
TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, main_stats);
TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, stats_sd);
cmdEnqueue(req);
}
@ -3995,22 +4004,20 @@ TFReqSetRegion::doWork(LLTextureFetch *)
}
TFReqSendMetrics::TFReqSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats):
const LLUUID & session_id,
const LLUUID & agent_id,
LLSD& stats_sd):
LLTextureFetch::TFRequest(),
mCapsURL(caps_url),
mSessionID(session_id),
mAgentID(agent_id),
mMainStats(main_stats),
mStatsSD(stats_sd),
mHandler(new AssetReportHandler)
{}
TFReqSendMetrics::~TFReqSendMetrics()
{
delete mMainStats;
mMainStats = 0;
}
@ -4031,26 +4038,18 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
static volatile bool reporting_started(false);
static volatile S32 report_sequence(0);
// We've taken over ownership of the stats copy at this
// point. Get a working reference to it for merging here
// but leave it in 'this'. Destructor will rid us of it.
LLViewerAssetStats & main_stats = *mMainStats;
LLViewerAssetStats::AssetStats stats;
main_stats.getStats(stats, true);
//LLSD merged_llsd = main_stats.asLLSD();
// In mStatsSD, we have a copy we own of the LLSD representation
// of the asset stats. Add some additional fields and ship it off.
bool initial_report = !reporting_started;
stats.session_id = mSessionID;
stats.agent_id = mAgentID;
stats.message = "ViewerAssetMetrics";
stats.sequence = static_cast<bool>(report_sequence);
stats.initial = initial_report;
stats.break_ = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
mStatsSD["session_id"] = mSessionID;
mStatsSD["agent_id"] = mAgentID;
mStatsSD["message"] = "ViewerAssetMetrics";
mStatsSD["sequence"] = report_sequence;
mStatsSD["initial"] = initial_report;
mStatsSD["break"] = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
LLSD sd;
LLParamSDParser parser;
parser.writeSD(sd, stats);
LL_INFOS(LOG_TXT) << "ViewerAssetMetrics after fields added\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
// Update sequence number
if (S32_MAX == ++report_sequence)
@ -4061,7 +4060,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// Limit the size of the stats report if necessary.
sd["truncated"] = truncate_viewer_metrics(10, sd);
mStatsSD["truncated"] = truncate_viewer_metrics(10, mStatsSD);
if (! mCapsURL.empty())
{
@ -4070,7 +4069,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
fetcher->getMetricsPolicyClass(),
report_priority,
mCapsURL,
sd,
mStatsSD,
LLCore::HttpOptions::ptr_t(),
fetcher->getMetricsHeaders(),
mHandler);
@ -4084,7 +4083,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// In QA mode, Metrics submode, log the result for ease of testing
if (fetcher->isQAMode())
{
LL_INFOS(LOG_TXT) << ll_pretty_print_sd(sd) << LL_ENDL;
LL_INFOS(LOG_TXT) << "ViewerAssetMetrics as submitted\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
}
return true;

View File

@ -160,7 +160,7 @@ public:
void commandSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats);
LLSD& stats_sd);
// Threads: T*
void commandDataBreak();

View File

@ -323,10 +323,10 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
grid_from_region_handle(it->first, &grid_x, &grid_y);
r .grid_x(grid_x)
.grid_y(grid_y)
.duration(F64Microseconds(rec.getDuration()).value());
.duration(F64Seconds(rec.getDuration()).value());
}
stats.duration(mCurRecording ? F64Microseconds(mCurRecording->getDuration()).value() : 0.0);
stats.duration(mCurRecording ? F64Seconds(mCurRecording->getDuration()).value() : 0.0);
}
LLSD LLViewerAssetStats::asLLSD(bool compact_output)
@ -376,7 +376,7 @@ void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp,
{
const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
record(sResponse[int(eac)], F64Microseconds(duration));
record(sResponse[int(eac)], F64Seconds(duration));
record(sBytesFetched[int(eac)], bytes);
}

View File

@ -33,6 +33,7 @@
#include "message.h"
#include "llagent.h"
#include "llappcorehttp.h"
#include "llviewerregion.h"
#include "lltransfersourceasset.h"
@ -428,6 +429,11 @@ void LLViewerAssetStorage::queueRequestHttp(
BOOL is_priority)
{
LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL;
if (!gAgent.getRegion())
{
LL_WARNS() << "No region, fetch fails" << LL_ENDL;
return;
}
std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset");
if (cap_url.empty())
{
@ -475,7 +481,7 @@ void LLViewerAssetStorage::assetRequestCoro(
std::string url = getAssetURL(uuid,atype);
LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL;
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);

View File

@ -96,7 +96,7 @@ if __name__ == "__main__":
for key in sorted(stats.keys()):
val = stats[key]
if val["count"] > 0:
print key,"count",val["count"],"mean_time",val["sum"]/val["count"],"mean_bytes",val["sum_bytes"]/val["count"],"enqueued",val["enqueued"],"dequeued",val["dequeued"]
print key,"count",val["count"],"mean_time",val["sum"]/val["count"],"mean_bytes",val["sum_bytes"]/val["count"],"net bytes/sec",val["sum_bytes"]/val["sum"],"enqueued",val["enqueued"],"dequeued",val["dequeued"]
else:
print key,"count",val["count"],"enqueued",val["enqueued"],"dequeued",val["dequeued"]