[prev in list] [next in list] [prev in thread] [next in thread]
List: graphicsmagick-commit
Subject: [GM-commit] GraphicsMagick: LogMagickEventList(): Cache broken-down time str...
From: GraphicsMagick Commits <graphicsmagick-commit () lists ! sourceforge ! net>
Date: 2020-03-08 18:07:46
Message-ID: mailman.36091.1583690882.1535.graphicsmagick-commit () lists ! sourceforge ! net
[Download RAW message or body]
changeset 045db84784ba in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=045db84784ba
summary: LogMagickEventList(): Cache broken-down time structure in LogInfo and \
recompute only when needed.
diffstat:
ChangeLog | 2 ++
magick/log.c | 22 +++++++++++++++++-----
www/Changelog.html | 4 +++-
3 files changed, 22 insertions(+), 6 deletions(-)
diffs (75 lines):
diff -r c0424b73d57e -r 045db84784ba ChangeLog
--- a/ChangeLog Sun Mar 08 10:55:24 2020 -0500
+++ b/ChangeLog Sun Mar 08 13:07:43 2020 -0500
@@ -3,6 +3,8 @@
* magick/log.c (LogMagickEventList): Prepare source module base
name more efficiently. Move MethodOutput implementation to the
front so it is not filtered by other active blocks.
+ (LogMagickEventList): Cache broken-down time structure in LogInfo
+ and recompute only when needed.
2020-03-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
diff -r c0424b73d57e -r 045db84784ba magick/log.c
--- a/magick/log.c Sun Mar 08 10:55:24 2020 -0500
+++ b/magick/log.c Sun Mar 08 13:07:43 2020 -0500
@@ -99,6 +99,12 @@
filename[256],
format[200];
+ time_t
+ last_seconds;
+
+ struct tm
+ last_tm;
+
} LogInfo;
/*
@@ -487,9 +493,6 @@
user_time;
struct tm
-#if defined(HAVE_LOCALTIME_R)
- tm_buf,
-#endif /* if defined(HAVE_LOCALTIME_R) */
*time_meridian;
time_t
@@ -620,11 +623,20 @@
#endif
LockSemaphoreInfo(log_info->log_semaphore);
seconds=time((time_t *) NULL);
+ if (seconds == log_info->last_seconds)
+ {
+ time_meridian=&log_info->last_tm;
+ }
+ else
+ {
+ log_info->last_seconds=seconds;
#if defined(HAVE_LOCALTIME_R)
- time_meridian=localtime_r(&seconds, &tm_buf);
+ time_meridian=localtime_r(&seconds, &log_info->last_tm);
#else
- time_meridian=localtime(&seconds); /* Possibly thread-unsafe version */
+ time_meridian=localtime(&seconds); /* Possibly thread-unsafe version */
+ (void) memcpy(&log_info->last_tm,time_meridian,sizeof(log_info->last_tm));
#endif /* if defined(HAVE_LOCALTIME_R) */
+ }
elapsed_time=GetElapsedTime(&log_info->timer);
user_time=GetUserTime(&log_info->timer);
(void) ContinueTimer((TimerInfo *) &log_info->timer);
diff -r c0424b73d57e -r 045db84784ba www/Changelog.html
--- a/www/Changelog.html Sun Mar 08 10:55:24 2020 -0500
+++ b/www/Changelog.html Sun Mar 08 13:07:43 2020 -0500
@@ -40,7 +40,9 @@
<ul class="simple">
<li>magick/log.c (LogMagickEventList): Prepare source module base
name more efficiently. Move MethodOutput implementation to the
-front so it is not filtered by other active blocks.</li>
+front so it is not filtered by other active blocks.
+(LogMagickEventList): Cache broken-down time structure in LogInfo
+and recompute only when needed.</li>
</ul>
</blockquote>
<p>2020-03-07 Bob Friesenhahn <<a class="reference external" \
href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span> \
4;</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p>
_______________________________________________
Graphicsmagick-commit mailing list
Graphicsmagick-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic