1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/url_request/url_request_job_metrics.h" 6 7 #include "base/basictypes.h" 8 #include "base/string_util.h" 9 10 using base::TimeDelta; 11 12 void URLRequestJobMetrics::AppendText(std::wstring* text) { 13 if (!text) 14 return; 15 16 text->append(L"job url = "); 17 text->append(UTF8ToWide(original_url_->spec())); 18 19 if (url_.get()) { 20 text->append(L"; redirected url = "); 21 text->append(UTF8ToWide(url_->spec())); 22 } 23 24 TimeDelta elapsed = end_time_ - start_time_; 25 StringAppendF(text, 26 L"; total bytes read = %ld; read calls = %d; time = %lld ms;", 27 static_cast<long>(total_bytes_read_), 28 number_of_read_IO_, elapsed.InMilliseconds()); 29 30 if (success_) { 31 text->append(L" success."); 32 } else { 33 text->append(L" fail."); 34 } 35 } 36