| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/stats_table.h" | 5 #include "base/stats_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 return impl_->counter_name(index); | 496 return impl_->counter_name(index); |
| 497 } | 497 } |
| 498 | 498 |
| 499 int StatsTable::GetRowValue(int index, int pid) const { | 499 int StatsTable::GetRowValue(int index, int pid) const { |
| 500 if (!impl_) | 500 if (!impl_) |
| 501 return 0; | 501 return 0; |
| 502 | 502 |
| 503 int rv = 0; | 503 int rv = 0; |
| 504 int* row = impl_->row(index); | 504 int* row = impl_->row(index); |
| 505 for (int index = 0; index < impl_->max_threads(); index++) { | 505 for (int slot_id = 0; slot_id < impl_->max_threads(); slot_id++) { |
| 506 if (pid == 0 || *impl_->thread_pid(index) == pid) | 506 if (pid == 0 || *impl_->thread_pid(slot_id) == pid) |
| 507 rv += row[index]; | 507 rv += row[slot_id]; |
| 508 } | 508 } |
| 509 return rv; | 509 return rv; |
| 510 } | 510 } |
| 511 | 511 |
| 512 int StatsTable::GetRowValue(int index) const { | 512 int StatsTable::GetRowValue(int index) const { |
| 513 return GetRowValue(index, 0); | 513 return GetRowValue(index, 0); |
| 514 } | 514 } |
| 515 | 515 |
| 516 int StatsTable::GetCounterValue(const std::string& name, int pid) { | 516 int StatsTable::GetCounterValue(const std::string& name, int pid) { |
| 517 if (!impl_) | 517 if (!impl_) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 if (!slot && !(slot = table->RegisterThread(""))) | 551 if (!slot && !(slot = table->RegisterThread(""))) |
| 552 return NULL; | 552 return NULL; |
| 553 | 553 |
| 554 // Find the counter id for the counter. | 554 // Find the counter id for the counter. |
| 555 std::string str_name(name); | 555 std::string str_name(name); |
| 556 int counter = table->FindCounter(str_name); | 556 int counter = table->FindCounter(str_name); |
| 557 | 557 |
| 558 // Now we can find the location in the table. | 558 // Now we can find the location in the table. |
| 559 return table->GetLocation(counter, slot); | 559 return table->GetLocation(counter, slot); |
| 560 } | 560 } |
| OLD | NEW |