summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_job_metrics.h
blob: 42108dbce5670ce50b3c02fae79722992d8b292d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Records IO statistics associated with a URLRequestJob.
// See description in navigation_profiler.h for an overview of perf profiling.

#ifndef NET_URL_REQUEST_URL_REQUEST_JOB_METRICS_H_
#define NET_URL_REQUEST_URL_REQUEST_JOB_METRICS_H_

#include <string>

#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"

class URLRequestJobMetrics {
 public:
  URLRequestJobMetrics() : total_bytes_read_(0), number_of_read_IO_(0) { }
  ~URLRequestJobMetrics() { }

  // The original url the job has been created for.
  scoped_ptr<GURL> original_url_;

  // The actual url the job connects to. If the actual url is same as the
  // original url, url_ is empty.
  scoped_ptr<GURL> url_;

  // Time when the job starts.
  base::TimeTicks start_time_;

  // Time when the job is done.
  base::TimeTicks end_time_;

  // Total number of bytes the job reads from underline IO.
  int total_bytes_read_;

  // Number of IO read operations the job issues.
  int number_of_read_IO_;

  // Final status of the job.
  bool success_;

  // Append the text report of the frame loading to the input string.
  void AppendText(std::wstring* text);
};

#endif  // NET_URL_REQUEST_URL_REQUEST_JOB_METRICS_H_