Merge branch '8.14'

This commit is contained in:
John Cupitt 2023-01-09 11:08:03 +00:00
commit b00a4a80d6
8 changed files with 49 additions and 23 deletions

View File

@ -1,9 +1,11 @@
xx/1/23 8.14.1
9/1/23 8.14.1
- add vips_thread_isworker() compatibility function [remicollet]
- add vips_semaphore_down_timeout() [kleisauke]
- idle threads are removed after 15s [kleisauke]
- fix version number in gtk-doc index [kleisauke]
- save mono fits images as NAXIS=2 [ewelot]
- fix jpeg `autorotate` for orientation 3 [zhifengzhuang]
22/12/22 8.14.0

View File

@ -67,8 +67,7 @@
* VipsTextWrap:
* @VIPS_TEXT_WRAP_WORD: wrap at word boundaries
* @VIPS_TEXT_WRAP_CHAR: wrap at character boundaries
* @VIPS_TEXT_WRAP_WORD_CHAR: wrap at word boundaries, but fall back to
* character boundaries if there is not enough space for a full word
* @VIPS_TEXT_WRAP_WORD_CHAR: wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word
* @VIPS_TEXT_WRAP_NONE: no wrapping
*
* Sets the word wrapping style for vips_text() when used with a maximum

View File

@ -37,6 +37,8 @@ create_headers = files(
'pmask.h',
)
libvips_sources += create_sources
create_lib = static_library('create',
create_sources,
create_headers,

View File

@ -36,6 +36,8 @@
* 27/10/22
* - band interleave ourselves on read
* - don't duplicate metadata
* 6/1/23 ewelot
* - save mono images as NAXIS=2
*/
/*
@ -658,7 +660,7 @@ vips_fits_set_header( VipsFits *fits, VipsImage *in )
status = 0;
fits->naxis = 3;
fits->naxis = in->Bands == 1 ? 2 : 3;
fits->naxes[0] = in->Xsize;
fits->naxes[1] = in->Ysize;
fits->naxes[2] = in->Bands;

View File

@ -979,9 +979,10 @@ vips__jpeg_read( ReadJpeg *jpeg, VipsImage *out, gboolean header_only )
/* Swap width and height if we're going to rotate this image.
*/
if( jpeg->autorotate &&
vips_image_get_orientation_swap( out ) ) {
VIPS_SWAP( int, out->Xsize, out->Ysize );
if( jpeg->autorotate ) {
if( vips_image_get_orientation_swap( out ) )
VIPS_SWAP( int, out->Xsize, out->Ysize );
vips_autorot_remove_angle( out );
}
}

View File

@ -405,7 +405,7 @@ vips_thread_main_loop( void *a, void *b )
!pool->error ) {
VIPS_GATE_START( "vips_worker_work_unit: u" );
vips_worker_work_unit( worker );
VIPS_GATE_STOP( "vips_thread_work_unit: u" );
VIPS_GATE_STOP( "vips_worker_work_unit: u" );
vips_semaphore_up( &pool->tick );
}

View File

@ -43,6 +43,10 @@
#endif /*HAVE_UNISTD_H*/
#include <errno.h>
/*
#define VIPS_DEBUG
*/
#include <vips/vips.h>
#include <vips/internal.h>
#include <vips/thread.h>
@ -105,10 +109,13 @@ vips_threadset_work( void *pointer )
VipsThreadsetMember *member = (VipsThreadsetMember *) pointer;
VipsThreadset *set = member->set;
VIPS_DEBUG_MSG( "vips_threadset_work: starting %p\n", member );
for(;;) {
/* Wait for at least 15 seconds to be given work.
*/
if( vips_semaphore_down_timeout( &member->idle, max_idle_time ) == -1 )
if( vips_semaphore_down_timeout( &member->idle,
max_idle_time ) == -1 )
break;
/* Killed or no task available? Leave this thread.
@ -150,6 +157,8 @@ vips_threadset_work( void *pointer )
set->free = g_slist_remove( set->free, member );
set->members = g_slist_remove( set->members, member );
set->n_threads -= 1;
VIPS_DEBUG_MSG( "vips_threadset_work: stopping %p (%d remaining)\n",
member, set->n_threads );
g_mutex_unlock( set->lock );
vips_semaphore_destroy( &member->idle );

View File

@ -1,7 +1,4 @@
#!/usr/bin/python
from __future__ import division
from __future__ import print_function
#!/usr/bin/python3
import re
import cairo
@ -154,7 +151,7 @@ for thread in threads:
all_events.sort(key=lambda x: x.start)
print('loaded %d events' % n_events)
print(f'loaded {n_events} events')
# move time axis to secs of computation
ticks_per_sec = 1000000.0
@ -173,7 +170,7 @@ for event in all_events:
last_time = (last_time - first_time) / ticks_per_sec
first_time = 0
print('total time =', last_time)
print(f'total time = {last_time}')
# calculate some simple stats
for thread in threads:
@ -202,7 +199,7 @@ for thread in threads:
# hide very short-lived threads
thread.hide = thread.alive < 0.01
print('name\t\talive\twait%\twork%\tunkn%\tmemory\tpeakm')
print('name alive wait% work% unkn% mem peakm')
for thread in threads:
if thread.hide:
continue
@ -211,11 +208,10 @@ for thread in threads:
work_percent = 100 * thread.work / thread.alive
unkn_percent = 100 - 100 * (thread.work + thread.wait) / thread.alive
print('%13s\t%6.2g\t' % (thread.thread_name, thread.alive), end=' ')
print('%.3g\t%.3g\t%.3g\t' %
(wait_percent, work_percent, unkn_percent), end=' ')
print('%.3g\t' % (thread.mem / (1024 * 1024)), end=' ')
print('%.3g\t' % (thread.peak_mem / (1024 * 1024)))
print((f'{thread.thread_name:>13}\t{thread.alive:6.2f}\t'
f'{wait_percent:>4.1f}\t{work_percent:>4.1f}\t{unkn_percent:>4.1f}\t'
f'{thread.mem / (1024 * 1024):>4.1f}\t'
f'{thread.peak_mem / (1024 * 1024):>4.1f}'))
mem = 0
peak_mem = 0
@ -225,9 +221,9 @@ for event in all_events:
if mem > peak_mem:
peak_mem = mem
print('peak memory = %.3g MB' % (peak_mem / (1024 * 1024)))
print(f'peak memory = {peak_mem / (1024 * 1024):.1f} MB')
if mem != 0:
print('leak! final memory = %.3g MB' % (mem / (1024 * 1024)))
print(f'leak! final memory = {mem / (1024 * 1024):.1f} MB')
# does a list of events contain an overlap?
# assume the list of events has been sorted by start time
@ -256,6 +252,21 @@ def gates_overlap(events, gate_name1, gate_name2):
return events_overlap(merged)
# show top 10 waits
wait = {}
for thread in threads:
for event in thread.all_events:
if event.wait:
name = f'{event.gate_location}::{event.gate_name}'
if name not in wait:
wait[name] = 0
wait[name] += event.stop - event.start
print('name wait')
for [name, time] in sorted(wait.items(), reverse=True, key=lambda x: x[1])[:10]:
print(f'{name:>35}\t{time:.2f}')
# allocate a y position for each gate
total_y = 0
for thread in threads: