OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 | 1871 |
1872 return true; | 1872 return true; |
1873 | 1873 |
1874 #else | 1874 #else |
1875 return false; | 1875 return false; |
1876 #endif | 1876 #endif |
1877 } | 1877 } |
1878 | 1878 |
1879 | 1879 |
1880 Sampler* Logger::sampler() { | 1880 Sampler* Logger::sampler() { |
| 1881 #ifdef ENABLE_LOGGING_AND_PROFILING |
1881 return ticker_; | 1882 return ticker_; |
| 1883 #else |
| 1884 return NULL; |
| 1885 #endif |
1882 } | 1886 } |
1883 | 1887 |
1884 | 1888 |
1885 void Logger::EnsureTickerStarted() { | 1889 void Logger::EnsureTickerStarted() { |
1886 #ifdef ENABLE_LOGGING_AND_PROFILING | 1890 #ifdef ENABLE_LOGGING_AND_PROFILING |
1887 ASSERT(ticker_ != NULL); | 1891 ASSERT(ticker_ != NULL); |
1888 if (!ticker_->IsActive()) ticker_->Start(); | 1892 if (!ticker_->IsActive()) ticker_->Start(); |
1889 #endif | 1893 #endif |
1890 } | 1894 } |
1891 | 1895 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 for (int i = 0; | 1952 for (int i = 0; |
1949 ActiveSamplersExist() && i < active_samplers_->length(); | 1953 ActiveSamplersExist() && i < active_samplers_->length(); |
1950 ++i) { | 1954 ++i) { |
1951 func(active_samplers_->at(i), param); | 1955 func(active_samplers_->at(i), param); |
1952 } | 1956 } |
1953 return ActiveSamplersExist(); | 1957 return ActiveSamplersExist(); |
1954 } | 1958 } |
1955 | 1959 |
1956 | 1960 |
1957 static void ComputeCpuProfiling(Sampler* sampler, void* flag_ptr) { | 1961 static void ComputeCpuProfiling(Sampler* sampler, void* flag_ptr) { |
| 1962 #ifdef ENABLE_LOGGING_AND_PROFILING |
1958 bool* flag = reinterpret_cast<bool*>(flag_ptr); | 1963 bool* flag = reinterpret_cast<bool*>(flag_ptr); |
1959 *flag |= sampler->IsProfiling(); | 1964 *flag |= sampler->IsProfiling(); |
| 1965 #endif |
1960 } | 1966 } |
1961 | 1967 |
1962 | 1968 |
1963 SamplerRegistry::State SamplerRegistry::GetState() { | 1969 SamplerRegistry::State SamplerRegistry::GetState() { |
1964 bool flag = false; | 1970 bool flag = false; |
1965 if (!IterateActiveSamplers(&ComputeCpuProfiling, &flag)) { | 1971 if (!IterateActiveSamplers(&ComputeCpuProfiling, &flag)) { |
1966 return HAS_NO_SAMPLERS; | 1972 return HAS_NO_SAMPLERS; |
1967 } | 1973 } |
1968 return flag ? HAS_CPU_PROFILING_SAMPLERS : HAS_SAMPLERS; | 1974 return flag ? HAS_CPU_PROFILING_SAMPLERS : HAS_SAMPLERS; |
1969 } | 1975 } |
(...skipping 14 matching lines...) Expand all Loading... |
1984 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1990 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1985 ASSERT(sampler->IsActive()); | 1991 ASSERT(sampler->IsActive()); |
1986 ScopedLock lock(mutex_); | 1992 ScopedLock lock(mutex_); |
1987 ASSERT(active_samplers_ != NULL); | 1993 ASSERT(active_samplers_ != NULL); |
1988 bool removed = active_samplers_->RemoveElement(sampler); | 1994 bool removed = active_samplers_->RemoveElement(sampler); |
1989 ASSERT(removed); | 1995 ASSERT(removed); |
1990 USE(removed); | 1996 USE(removed); |
1991 } | 1997 } |
1992 | 1998 |
1993 } } // namespace v8::internal | 1999 } } // namespace v8::internal |
OLD | NEW |