MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testThreading

Method testThreading

test/IECoreGL/CachedConverterTest.py:74–112  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

72 self.assertTrue( c1.isSame( c2 ) )
73
74 def testThreading( self ) :
75
76 r = imath.Rand32()
77 pv = IECore.V3fVectorData()
78 for i in range( 0, 10000 ) :
79 pv.append( imath.V3f( r.nextf(), r.nextf(), r.nextf() ) )
80
81 p = IECoreScene.PointsPrimitive( pv.copy() )
82
83 pv.append( imath.V3f( r.nextf(), r.nextf(), r.nextf() ) )
84 p2 = IECoreScene.PointsPrimitive( pv.copy() )
85
86 self.assertNotEqual( p, p2 )
87
88 for i in range( 0, 100 ) :
89
90 pg = []
91 pg2 = []
92
93 c = IECoreGL.CachedConverter( 5000 * 1024 * 1024 ) # 500 megs
94
95 def t() :
96
97 pg.append( c.convert( p ) )
98 pg2.append( c.convert( p2 ) )
99
100 threads = []
101 for j in range( 0, 100 ) :
102 thread = threading.Thread( target = t )
103 threads.append( thread )
104 thread.start()
105
106 for thread in threads :
107 thread.join()
108
109 for o in pg :
110 self.assertTrue( o.isSame( c.convert( p ) ) )
111 for o in pg2 :
112 self.assertTrue( o.isSame( c.convert( p2 ) ) )
113
114 def testThrashing( self ) :
115

Callers

nothing calls this directly

Calls 7

convertMethod · 0.95
appendMethod · 0.80
PointsPrimitiveMethod · 0.80
CachedConverterMethod · 0.80
joinMethod · 0.80
copyMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected