| 67 | } |
| 68 | |
| 69 | long long class_counter::count(const char *name) { |
| 70 | if (lock_) { |
| 71 | lock_->lock(); |
| 72 | } |
| 73 | |
| 74 | long long ret; |
| 75 | |
| 76 | std::map<std::string, long long>::const_iterator it = names_.find(name); |
| 77 | if (it == names_.end()) { |
| 78 | ret = 0; |
| 79 | } else { |
| 80 | ret = it->second; |
| 81 | } |
| 82 | |
| 83 | if (lock_) { |
| 84 | lock_->unlock(); |
| 85 | } |
| 86 | return ret; |
| 87 | } |
| 88 | |
| 89 | void class_counter::print(const char *flag) { |
| 90 | string buf(2048); |