View | Details | Raw Unified | Return to bug 216745 | Differences between
and this patch

Collapse All | Expand All

(-).libs/performance_counters.o (-109 / +64 lines)
Lines 1-7 Link Here
1
# 1 "performance_counters.cpp"
1
# 1 "performance_counters.cpp"
2
# 1 "<built-in>" 1
2
# 1 "<built-in>" 1
3
# 1 "<built-in>" 3
3
# 1 "<built-in>" 3
4
# 335 "<built-in>" 3
4
# 336 "<built-in>" 3
5
# 1 "<command line>" 1
5
# 1 "<command line>" 1
6
# 1 "<built-in>" 2
6
# 1 "<built-in>" 2
7
# 1 "performance_counters.cpp" 2
7
# 1 "performance_counters.cpp" 2
Lines 1637-1644 Link Here
1637
# 1 "/usr/include/c++/v1/inttypes.h" 1 3
1637
# 1 "/usr/include/c++/v1/inttypes.h" 1 3
1638
# 238 "/usr/include/c++/v1/inttypes.h" 3
1638
# 238 "/usr/include/c++/v1/inttypes.h" 3
1639
# 247 "/usr/include/c++/v1/inttypes.h" 3
1639
# 247 "/usr/include/c++/v1/inttypes.h" 3
1640
# 1 "/usr/local/llvm39/bin/../lib/clang/3.9.1/include/inttypes.h" 1 3 4
1641
# 30 "/usr/local/llvm39/bin/../lib/clang/3.9.1/include/inttypes.h" 3 4
1642
# 1 "/usr/include/inttypes.h" 1 3 4
1640
# 1 "/usr/include/inttypes.h" 1 3 4
1643
# 32 "/usr/include/inttypes.h" 3 4
1641
# 32 "/usr/include/inttypes.h" 3 4
1644
# 1 "/usr/include/machine/_inttypes.h" 1 3 4
1642
# 1 "/usr/include/machine/_inttypes.h" 1 3 4
Lines 1713-1719 Link Here
1713
uintmax_t wcstoumax(const wchar_t * ,
1711
uintmax_t wcstoumax(const wchar_t * ,
1714
      wchar_t ** , int);
1712
      wchar_t ** , int);
1715
}
1713
}
1716
# 31 "/usr/local/llvm39/bin/../lib/clang/3.9.1/include/inttypes.h" 2 3 4
1717
# 248 "/usr/include/c++/v1/inttypes.h" 2 3
1714
# 248 "/usr/include/c++/v1/inttypes.h" 2 3
1718
1715
1719
1716
Lines 6153-6173 Link Here
6153
void *bsearch(const void *, const void *, size_t,
6150
void *bsearch(const void *, const void *, size_t,
6154
     size_t, int (*)(const void * _Nonnull, const void *));
6151
     size_t, int (*)(const void * _Nonnull, const void *));
6155
void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__))
6152
void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__))
6156
                                     ;
6153
      __attribute__((__alloc_size__(1))) __attribute__((__alloc_size__(2)));
6157
div_t div(int, int) __attribute__((__const__));
6154
div_t div(int, int) __attribute__((__const__));
6158
[[noreturn]] void exit(int);
6155
[[noreturn]] void exit(int);
6159
void free(void *);
6156
void free(void *);
6160
char *getenv(const char *);
6157
char *getenv(const char *);
6161
long labs(long) __attribute__((__const__));
6158
long labs(long) __attribute__((__const__));
6162
ldiv_t ldiv(long, long) __attribute__((__const__));
6159
ldiv_t ldiv(long, long) __attribute__((__const__));
6163
void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) ;
6160
void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1)));
6164
int mblen(const char *, size_t);
6161
int mblen(const char *, size_t);
6165
size_t mbstowcs(wchar_t * , const char * , size_t);
6162
size_t mbstowcs(wchar_t * , const char * , size_t);
6166
int mbtowc(wchar_t * , const char * , size_t);
6163
int mbtowc(wchar_t * , const char * , size_t);
6167
void qsort(void *, size_t, size_t,
6164
void qsort(void *, size_t, size_t,
6168
     int (* _Nonnull)(const void *, const void *));
6165
     int (* _Nonnull)(const void *, const void *));
6169
int rand(void);
6166
int rand(void);
6170
void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) ;
6167
void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2)));
6171
void srand(unsigned);
6168
void srand(unsigned);
6172
double strtod(const char * , char ** );
6169
double strtod(const char * , char ** );
6173
float strtof(const char * , char ** );
6170
float strtof(const char * , char ** );
Lines 6209-6215 Link Here
6209
6206
6210
6207
6211
void * aligned_alloc(size_t, size_t) __attribute__((__malloc__))
6208
void * aligned_alloc(size_t, size_t) __attribute__((__malloc__))
6212
                    ;
6209
     __attribute__((__alloc_size__(2)));
6213
int at_quick_exit(void (*)(void));
6210
int at_quick_exit(void (*)(void));
6214
[[noreturn]] void
6211
[[noreturn]] void
6215
 quick_exit(int);
6212
 quick_exit(int);
Lines 6320-6328 Link Here
6320
     int (*)(void *, const void *, const void *));
6317
     int (*)(void *, const void *, const void *));
6321
int radixsort(const unsigned char **, int, const unsigned char *,
6318
int radixsort(const unsigned char **, int, const unsigned char *,
6322
     unsigned);
6319
     unsigned);
6323
void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__))
6320
void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2)))
6324
                    ;
6321
     __attribute__((__alloc_size__(3)));
6325
void *reallocf(void *, size_t) ;
6322
void *reallocf(void *, size_t) __attribute__((__alloc_size__(2)));
6326
int rpmatch(const char *);
6323
int rpmatch(const char *);
6327
void setprogname(const char *);
6324
void setprogname(const char *);
6328
int sradixsort(const unsigned char **, int, const unsigned char *,
6325
int sradixsort(const unsigned char **, int, const unsigned char *,
Lines 22154-22162 Link Here
22154
    if (__n == 0)
22151
    if (__n == 0)
22155
        return 0;
22152
        return 0;
22156
22153
22157
22154
    return __builtin_memcmp(__s1, __s2, __n);
22158
22159
    return memcmp(__s1, __s2, __n);
22160
# 260 "/usr/include/c++/v1/__string" 3
22155
# 260 "/usr/include/c++/v1/__string" 3
22161
}
22156
}
22162
22157
Lines 22167-22175 Link Here
22167
    if (__n == 0)
22162
    if (__n == 0)
22168
        return nullptr;
22163
        return nullptr;
22169
22164
22170
22165
    return __builtin_char_memchr(__s, to_int_type(__a), __n);
22171
22172
    return (const char_type*) memchr(__s, to_int_type(__a), __n);
22173
# 281 "/usr/include/c++/v1/__string" 3
22166
# 281 "/usr/include/c++/v1/__string" 3
22174
}
22167
}
22175
22168
Lines 22227-22235 Link Here
22227
    if (__n == 0)
22220
    if (__n == 0)
22228
        return 0;
22221
        return 0;
22229
22222
22230
22223
    return __builtin_wmemcmp(__s1, __s2, __n);
22231
22232
    return wmemcmp(__s1, __s2, __n);
22233
# 350 "/usr/include/c++/v1/__string" 3
22224
# 350 "/usr/include/c++/v1/__string" 3
22234
}
22225
}
22235
22226
Lines 22238-22252 Link Here
22238
char_traits<wchar_t>::length(const char_type* __s) noexcept
22229
char_traits<wchar_t>::length(const char_type* __s) noexcept
22239
{
22230
{
22240
22231
22241
22232
    return __builtin_wcslen(__s);
22242
22233
# 366 "/usr/include/c++/v1/__string" 3
22243
    return wcslen(__s);
22244
22245
22246
22247
22248
22249
22250
}
22234
}
22251
22235
22252
inline
22236
inline
Lines 22256-22264 Link Here
22256
    if (__n == 0)
22240
    if (__n == 0)
22257
        return nullptr;
22241
        return nullptr;
22258
22242
22259
22243
        return __builtin_wmemchr(__s, __a, __n);
22260
22261
    return wmemchr(__s, __a, __n);
22262
# 387 "/usr/include/c++/v1/__string" 3
22244
# 387 "/usr/include/c++/v1/__string" 3
22263
}
22245
}
22264
22246
Lines 42106-42156 Link Here
42106
}
42088
}
42107
}
42089
}
42108
# 21 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp" 2
42090
# 21 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp" 2
42109
# 33 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42110
# 1 "/usr/local/include/boost/atomic/detail/ops_extending_cas_based.hpp" 1
42111
# 26 "/usr/local/include/boost/atomic/detail/ops_extending_cas_based.hpp"
42112
namespace boost {
42113
namespace atomics {
42114
namespace detail {
42115
42116
template< typename Base, std::size_t Size, bool Signed >
42117
struct extending_cas_based_operations :
42118
    public Base
42119
{
42120
    typedef typename Base::storage_type storage_type;
42121
    typedef typename make_storage_type< Size, Signed >::type emulated_storage_type;
42122
42123
    static inline __attribute__ ((__always_inline__)) storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) noexcept
42124
    {
42125
        storage_type old_val;
42126
        atomics::detail::non_atomic_load(storage, old_val);
42127
        emulated_storage_type new_val;
42128
        do
42129
        {
42130
            new_val = static_cast< emulated_storage_type >(old_val) + static_cast< emulated_storage_type >(v);
42131
        }
42132
        while (!Base::compare_exchange_weak(storage, old_val, static_cast< storage_type >(new_val), order, memory_order_relaxed));
42133
        return old_val;
42134
    }
42135
42136
    static inline __attribute__ ((__always_inline__)) storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) noexcept
42137
    {
42138
        storage_type old_val;
42139
        atomics::detail::non_atomic_load(storage, old_val);
42140
        emulated_storage_type new_val;
42141
        do
42142
        {
42143
            new_val = static_cast< emulated_storage_type >(old_val) - static_cast< emulated_storage_type >(v);
42144
        }
42145
        while (!Base::compare_exchange_weak(storage, old_val, static_cast< storage_type >(new_val), order, memory_order_relaxed));
42146
        return old_val;
42147
    }
42148
};
42149
42150
}
42151
}
42152
}
42153
# 34 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp" 2
42154
# 48 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42091
# 48 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42155
namespace boost {
42092
namespace boost {
42156
namespace atomics {
42093
namespace atomics {
Lines 42250-42255 Link Here
42250
        return __atomic_is_lock_free(sizeof(storage_type), &storage);
42187
        return __atomic_is_lock_free(sizeof(storage_type), &storage);
42251
    }
42188
    }
42252
};
42189
};
42190
# 222 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42191
template< bool Signed >
42192
struct operations< 8u, Signed > :
42193
    public gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >
42194
{
42195
    typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
42196
};
42253
# 263 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42197
# 263 "/usr/local/include/boost/atomic/detail/ops_gcc_atomic.hpp"
42254
template< bool Signed >
42198
template< bool Signed >
42255
struct operations< 4u, Signed > :
42199
struct operations< 4u, Signed > :
Lines 44096-44104 Link Here
44096
  void blend_stats_counter(int c, boost::int64_t value, int ratio);
44040
  void blend_stats_counter(int c, boost::int64_t value, int ratio);
44097
44041
44098
 private:
44042
 private:
44099
# 459 "../include/libtorrent/performance_counters.hpp"
44043
44100
  mutable mutex m_mutex;
44044
44101
  boost::int64_t m_stats_counter[num_counters];
44045
44046
44047
44048
44049
  boost::atomic<boost::int64_t> m_stats_counter[num_counters];
44050
44051
44052
44053
44054
44102
44055
44103
 };
44056
 };
44104
}
44057
}
Lines 44116-44156 Link Here
44116
 counters::counters()
44069
 counters::counters()
44117
 {
44070
 {
44118
44071
44072
  for (int i = 0; i < sizeof(m_stats_counter)
44073
   / sizeof(m_stats_counter[0]); ++i)
44074
   m_stats_counter[i].store(0, boost::memory_order_relaxed);
44119
44075
44120
44076
44121
44077
44122
44123
  memset(m_stats_counter, 0, sizeof(m_stats_counter));
44124
44125
 }
44078
 }
44126
44079
44127
 counters::counters(counters const& c)
44080
 counters::counters(counters const& c)
44128
 {
44081
 {
44129
44082
44083
  for (int i = 0; i < sizeof(m_stats_counter)
44084
   / sizeof(m_stats_counter[0]); ++i)
44085
   m_stats_counter[i].store(
44086
    c.m_stats_counter[i].load(boost::memory_order_relaxed)
44087
     , boost::memory_order_relaxed);
44130
44088
44131
44089
44132
44090
44133
44091
44134
44135
44136
  mutex::scoped_lock l(c.m_mutex);
44137
  memcpy(m_stats_counter, c.m_stats_counter, sizeof(m_stats_counter));
44138
44139
 }
44092
 }
44140
44093
44141
 counters& counters::operator=(counters const& c)
44094
 counters& counters::operator=(counters const& c)
44142
 {
44095
 {
44143
44096
44097
  for (int i = 0; i < sizeof(m_stats_counter)
44098
   / sizeof(m_stats_counter[0]); ++i)
44099
   m_stats_counter[i].store(
44100
    c.m_stats_counter[i].load(boost::memory_order_relaxed)
44101
     , boost::memory_order_relaxed);
44144
44102
44145
44103
44146
44104
44147
44105
44148
44106
44149
44150
  mutex::scoped_lock l(m_mutex);
44151
  mutex::scoped_lock l2(c.m_mutex);
44152
  memcpy(m_stats_counter, c.m_stats_counter, sizeof(m_stats_counter));
44153
44154
  return *this;
44107
  return *this;
44155
 }
44108
 }
44156
44109
Lines 44163-44172 Link Here
44163
44116
44164
44117
44165
44118
44119
  return m_stats_counter[i].load(boost::memory_order_relaxed);
44120
44166
44121
44167
44122
44168
  mutex::scoped_lock l(m_mutex);
44169
  return m_stats_counter[i];
44170
44123
44171
 }
44124
 }
44172
44125
Lines 44182-44194 Link Here
44182
  do {} while (0);
44135
  do {} while (0);
44183
44136
44184
44137
44138
  boost::int64_t pv = m_stats_counter[c].fetch_add(value, boost::memory_order_relaxed);
44139
  do {} while (0);
44140
  return pv + value;
44185
44141
44186
44142
44187
44143
44188
44144
44189
  mutex::scoped_lock l(m_mutex);
44190
  do {} while (0);
44191
  return m_stats_counter[c] += value;
44192
44145
44193
 }
44146
 }
44194
44147
Lines 44200-44228 Link Here
44200
  do {} while (0);
44153
  do {} while (0);
44201
  do {} while (0);
44154
  do {} while (0);
44202
  do {} while (0);
44155
  do {} while (0);
44203
# 142 "performance_counters.cpp"
44204
  mutex::scoped_lock l(m_mutex);
44205
  boost::int64_t current = m_stats_counter[c];
44206
  m_stats_counter[c] = (current * (100-ratio) + value * ratio) / 100;
44207
44156
44208
 }
44209
44157
44210
 void counters::set_value(int c, boost::int64_t value)
44158
  boost::int64_t current = m_stats_counter[c].load(boost::memory_order_relaxed);
44211
 {
44159
  boost::int64_t new_value = (current * (100-ratio) + value * ratio) / 100;
44212
  do {} while (0);
44213
  do {} while (0);
44214
44160
44161
  while (!m_stats_counter[c].compare_exchange_weak(current, new_value
44162
   , boost::memory_order_relaxed))
44163
  {
44164
   new_value = (current * (100-ratio) + value * ratio) / 100;
44165
  }
44215
44166
44216
44167
44217
44168
44218
  mutex::scoped_lock l(m_mutex);
44219
44169
44220
44170
44171
 }
44221
44172
44173
 void counters::set_value(int c, boost::int64_t value)
44174
 {
44175
  do {} while (0);
44222
  do {} while (0);
44176
  do {} while (0);
44223
44177
44224
  m_stats_counter[c] = value;
44225
44178
44179
  m_stats_counter[c].store(value);
44180
# 164 "performance_counters.cpp"
44226
 }
44181
 }
44227
44182
44228
}
44183
}

Return to bug 216745