profileFileName = 'Profiles/pythonray_' + time.strftime('%Y%m%d_%H%M%S'
    ) + '.profile'
profile = cProfile.Profile()
profile.run('pilImage = camera.render(scene, samplePattern)')
Using cProfile results with KCacheGrind