Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
73c0e65f
Kaydet (Commit)
73c0e65f
authored
Ara 17, 2008
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #2467: gc.DEBUG_STATS reports invalid elapsed times.
Patch by Neil Schemenauer, very slightly modified.
üst
1a707981
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
+30
-23
NEWS
Misc/NEWS
+4
-0
gcmodule.c
Modules/gcmodule.c
+26
-23
No files found.
Misc/NEWS
Dosyayı görüntüle @
73c0e65f
...
@@ -12,6 +12,10 @@ What's New in Python 2.7 alpha 1
...
@@ -12,6 +12,10 @@ What's New in Python 2.7 alpha 1
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #2467: gc.DEBUG_STATS reported invalid elapsed times. Also, always
print elapsed times, not only when some objects are uncollectable /
unreachable. Original patch by Neil Schemenauer.
- Issue #3439: Add a bit_length method to int and long.
- Issue #3439: Add a bit_length method to int and long.
- Issue #2183: Simplify and optimize bytecode for list comprehensions.
- Issue #2183: Simplify and optimize bytecode for list comprehensions.
...
...
Modules/gcmodule.c
Dosyayı görüntüle @
73c0e65f
...
@@ -740,6 +740,24 @@ clear_freelists(void)
...
@@ -740,6 +740,24 @@ clear_freelists(void)
(
void
)
PyFloat_ClearFreeList
();
(
void
)
PyFloat_ClearFreeList
();
}
}
static
double
get_time
(
void
)
{
double
result
=
0
;
if
(
tmod
!=
NULL
)
{
PyObject
*
f
=
PyObject_CallMethod
(
tmod
,
"time"
,
NULL
);
if
(
f
==
NULL
)
{
PyErr_Clear
();
}
else
{
if
(
PyFloat_Check
(
f
))
result
=
PyFloat_AsDouble
(
f
);
Py_DECREF
(
f
);
}
}
return
result
;
}
/* This is the main function. Read this to understand how the
/* This is the main function. Read this to understand how the
* collection process works. */
* collection process works. */
static
Py_ssize_t
static
Py_ssize_t
...
@@ -762,16 +780,7 @@ collect(int generation)
...
@@ -762,16 +780,7 @@ collect(int generation)
}
}
if
(
debug
&
DEBUG_STATS
)
{
if
(
debug
&
DEBUG_STATS
)
{
if
(
tmod
!=
NULL
)
{
t1
=
get_time
();
PyObject
*
f
=
PyObject_CallMethod
(
tmod
,
"time"
,
NULL
);
if
(
f
==
NULL
)
{
PyErr_Clear
();
}
else
{
t1
=
PyFloat_AsDouble
(
f
);
Py_DECREF
(
f
);
}
}
PySys_WriteStderr
(
"gc: collecting generation %d...
\n
"
,
PySys_WriteStderr
(
"gc: collecting generation %d...
\n
"
,
generation
);
generation
);
PySys_WriteStderr
(
"gc: objects in each generation:"
);
PySys_WriteStderr
(
"gc: objects in each generation:"
);
...
@@ -844,17 +853,6 @@ collect(int generation)
...
@@ -844,17 +853,6 @@ collect(int generation)
if
(
debug
&
DEBUG_COLLECTABLE
)
{
if
(
debug
&
DEBUG_COLLECTABLE
)
{
debug_cycle
(
"collectable"
,
FROM_GC
(
gc
));
debug_cycle
(
"collectable"
,
FROM_GC
(
gc
));
}
}
if
(
tmod
!=
NULL
&&
(
debug
&
DEBUG_STATS
))
{
PyObject
*
f
=
PyObject_CallMethod
(
tmod
,
"time"
,
NULL
);
if
(
f
==
NULL
)
{
PyErr_Clear
();
}
else
{
t1
=
PyFloat_AsDouble
(
f
)
-
t1
;
Py_DECREF
(
f
);
PySys_WriteStderr
(
"gc: %.4fs elapsed.
\n
"
,
t1
);
}
}
}
}
/* Clear weakrefs and invoke callbacks as necessary. */
/* Clear weakrefs and invoke callbacks as necessary. */
...
@@ -876,14 +874,19 @@ collect(int generation)
...
@@ -876,14 +874,19 @@ collect(int generation)
debug_cycle
(
"uncollectable"
,
FROM_GC
(
gc
));
debug_cycle
(
"uncollectable"
,
FROM_GC
(
gc
));
}
}
if
(
debug
&
DEBUG_STATS
)
{
if
(
debug
&
DEBUG_STATS
)
{
double
t2
=
get_time
();
if
(
m
==
0
&&
n
==
0
)
if
(
m
==
0
&&
n
==
0
)
PySys_WriteStderr
(
"gc: done
.
\n
"
);
PySys_WriteStderr
(
"gc: done"
);
else
else
PySys_WriteStderr
(
PySys_WriteStderr
(
"gc: done, "
"gc: done, "
"%"
PY_FORMAT_SIZE_T
"d unreachable, "
"%"
PY_FORMAT_SIZE_T
"d unreachable, "
"%"
PY_FORMAT_SIZE_T
"d uncollectable
.
\n
"
,
"%"
PY_FORMAT_SIZE_T
"d uncollectable"
,
n
+
m
,
n
);
n
+
m
,
n
);
if
(
t1
&&
t2
)
{
PySys_WriteStderr
(
", %.4fs elapsed"
,
t2
-
t1
);
}
PySys_WriteStderr
(
".
\n
"
);
}
}
/* Append instances in the uncollectable set to a Python
/* Append instances in the uncollectable set to a Python
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment