예제 #1
0
    def test_c_ann_trace(self):
        target_cmd = [ './ci_test_c_ann' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 10)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'event.end#phase': 'loop', 'phase': 'loop'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'event.end#iteration': '3', 'iteration': '3', 'phase': 'loop'}))
        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'attr.int', 'attr.dbl', 'attr.str', 'ci_test_c_ann.setbyname' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'attr.int' : '20', 'attr.str' : 'fidibus' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'test-attr-with-metadata' : 'abracadabra' }))
예제 #2
0
    def test_thread(self):
        target_cmd = [ './ci_test_thread' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'thread-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 20)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'local', 'global', 'function'}))
        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, {'pthread.id', 'my_thread_id', 'global', 'event.end#function'}))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'my_thread_id' : '49', 
                        'function'     : 'thread_proc', 
                        'global'       : '999' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, { 'function'    : 'main',
                         'local'       : '99' }))
예제 #3
0
    def test_c_ann_globals(self):
        target_cmd = ['./ci_test_c_ann']
        query_cmd = [
            '../../src/tools/cali-query/cali-query', '-e', '--list-globals'
        ]

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 1)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {
                    'global.double', 'global.string', 'global.int',
                    'global.uint', 'cali.caliper.version'
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'global.int': '1337',
                    'global.string': 'my global string',
                    'global.uint': '42'
                }))
예제 #4
0
    def test_callpath(self):
        target_cmd = ['./ci_test_alloc']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'callpath,trace,recorder',
            'CALI_CALLPATH_USE_NAME': 'true',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 3)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {
                    'callpath.address', 'callpath.regname',
                    'test_alloc.allocated.0', 'function'
                }))

        sreg = cat.get_snapshot_with_keys(
            snapshots, {'callpath.regname', 'test_alloc.allocated.0'})

        self.assertTrue('main' in sreg.get('callpath.regname'))
예제 #5
0
    def test_aggregate_value_key(self):
        target_cmd = ['./ci_test_aggregate']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'aggregate:event:recorder',
            'CALI_AGGREGATE_KEY': 'iteration',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'iteration': '1',
                'count': '8'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'iteration': '3',
                'count': '3'
            }))
        self.assertFalse(
            calitest.has_snapshot_with_keys(snapshots,
                                            ['function', 'loop.id']))
예제 #6
0
    def test_aggregate_default(self):
        target_cmd = ['./ci_test_aggregate']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'aggregate:event:recorder:timestamp',
            'CALI_TIMER_SNAPSHOT_DURATION': 'true',
            'CALI_TIMER_INCLUSIVE_DURATION': 'true',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(
            calitest.has_snapshot_with_keys(snapshots, [
                'loop.id', 'function', 'sum#time.inclusive.duration',
                'min#time.inclusive.duration', 'max#time.inclusive.duration',
                'sum#time.duration', 'count'
            ]))

        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#function': 'foo',
                'loop.id': 'A',
                'count': '6'
            }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'event.end#function': 'foo',
                'loop.id': 'B',
                'count': '4'
            }))
예제 #7
0
    def test_basic_trace(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'initialization',
                'phase': 'initialization'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
예제 #8
0
    def test_sampler_symbollookup(self):
        target_cmd = ['./ci_dgemm_memtrack']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'sampler:symbollookup:trace:recorder',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots, {
                    'cali.sampler.pc', 'source.function#cali.sampler.pc',
                    'source.file#cali.sampler.pc',
                    'source.line#cali.sampler.pc', 'function'
                }))

        sfile = calitest.get_snapshot_with_keys(
            snapshots, {'source.file#cali.sampler.pc'})

        self.assertTrue(
            'ci_dgemm_memtrack' in sfile.get('source.file#cali.sampler.pc'))
예제 #9
0
    def test_cali_config(self):
        # Test the builtin ConfigManager (CALI_CONFIG env var)

        target_cmd = ['./ci_test_basic']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_LOG_VERBOSITY': '0',
            'CALI_CONFIG': 'event-trace,output=stdout'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'initialization',
                'phase': 'initialization'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
예제 #10
0
    def test_sampler_symbollookup(self):
        target_cmd = [ './ci_dgemm_memtrack' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'sampler:symbollookup:trace:recorder',
            'CALI_SYMBOLLOOKUP_LOOKUP_FILE' : 'true',
            'CALI_SYMBOLLOOKUP_LOOKUP_LINE' : 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'cali.sampler.pc', 
                         'source.function#cali.sampler.pc', 
                         'source.file#cali.sampler.pc',
                         'source.line#cali.sampler.pc',
                         'sourceloc#cali.sampler.pc',
                         'function' }))

        sfile = calitest.get_snapshot_with_keys(snapshots, { 'source.file#cali.sampler.pc' })

        self.assertTrue('ci_dgemm_memtrack' in sfile.get('source.file#cali.sampler.pc'))
예제 #11
0
    def test_ioservice(self):
        target_cmd = [
            './ci_test_io', 'event-trace(trace.io=true),output=stdout'
        ]
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'io.bytes.read': '16',
                'io.region': 'read',
                'function': 'main'
            }))

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'io.bytes.read', 'io.region', 'io.filesystem', 'io.mount.point'
            }))
예제 #12
0
    def test_aggregate_default(self):
        target_cmd = [ './ci_test_aggregate' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'aggregate:event:recorder:timestamp',
            'CALI_TIMER_SNAPSHOT_DURATION' : 'true',
            'CALI_TIMER_INCLUSIVE_DURATION' : 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, [ 'loop.id', 'function', 
                         'sum#time.inclusive.duration',
                         'min#time.inclusive.duration',
                         'max#time.inclusive.duration',
                         'sum#time.duration',
                         'count' ] ))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'loop.id': 'A',
                'count': '6' }))
        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {
                'event.end#function': 'foo', 
                'loop.id': 'B',
                'count': '4' }))
예제 #13
0
    def test_sampler_symbollookup(self):
        target_cmd = [ './ci_test_macros', '5000' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'sampler:symbollookup:trace:recorder',
            'CALI_SYMBOLLOOKUP_LOOKUP_FILE'   : 'true',
            'CALI_SYMBOLLOOKUP_LOOKUP_LINE'   : 'true',
            'CALI_SYMBOLLOOKUP_LOOKUP_MODULE' : 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'cali.sampler.pc', 
                         'source.function#cali.sampler.pc', 
                         'source.file#cali.sampler.pc',
                         'source.line#cali.sampler.pc',
                         'sourceloc#cali.sampler.pc',
                         'module#cali.sampler.pc',
                         'function', 'loop' }))
예제 #14
0
    def test_c_ann_trace(self):
        target_cmd = ['./ci_test_c_ann']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'serial-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 10)

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'iteration', 'phase', 'time.inclusive.duration', 'global.int'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#phase': 'loop',
                'phase': 'loop'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'event.end#iteration': '3',
                'iteration': '3',
                'phase': 'loop'
            }))
        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots, {
                'attr.int', 'attr.dbl', 'attr.str', 'ci_test_c_ann.setbyname'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots, {
                'attr.int': '20',
                'attr.str': 'fidibus'
            }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {'test-attr-with-metadata': 'abracadabra'}))
예제 #15
0
    def test_hatchet_sample_profile(self):
        target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(output=stdout,output.format=cali)' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 0)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'loop', 'function' }))
예제 #16
0
    def test_spot_controller(self):
        target_cmd = ['./ci_test_mpi_before_cali', 'spot(output=stdout)']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'PATH': '/usr/bin',  # for ssh/rsh
            'CALI_LOG_VERBOSITY': '0',
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'function', 'avg#inclusive#sum#time.duration'}))
예제 #17
0
    def test_report_attribute_aliases(self):
        target_cmd = ['./ci_test_macros']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'event,trace,report',
            'CALI_REPORT_CONFIG':
            'select function as my\\ function\\ alias,count() group by function format expand',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output, _ = cat.run_test(target_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_keys(snapshots,
                                       {'my function alias', 'count'}))
예제 #18
0
    def test_globals(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e', '--list-globals' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertEqual(len(snapshots), 1)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'cali.caliper.version' } ) )
예제 #19
0
    def test_globals(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e', '--list-globals' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertEqual(len(snapshots), 1)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'cali.caliper.version' } ) )
예제 #20
0
    def test_thread(self):
        target_cmd = ['./ci_test_thread']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_CONFIG_PROFILE': 'thread-trace',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) >= 20)

        self.assertTrue(
            calitest.has_snapshot_with_keys(snapshots,
                                            {'local', 'global', 'function'}))
        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots, {
                    'pthread.id', 'pthread.is_master', 'my_thread_id',
                    'global', 'function'
                }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(
                snapshots, {
                    'my_thread_id': '49',
                    'pthread.is_master': 'false',
                    'function': 'thread_proc',
                    'global': '999'
                }))
        self.assertTrue(
            calitest.has_snapshot_with_attributes(snapshots, {
                'function': 'main',
                'pthread.is_master': 'true',
                'local': '99'
            }))

        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots,
                {'pthread.id', 'my_thread_id', 'global', 'pthread_exp'}))
        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots, {'global', 'my_thread_id', 'nopthread_exp'}))
        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots, {'event.set#pthread.id', 'pthread_exp'}))
        self.assertFalse(
            calitest.has_snapshot_with_keys(
                snapshots, {'event.set#pthread.id', 'nopthread_exp'}))
예제 #21
0
    def test_alloc(self):
        target_cmd = [ './ci_test_alloc' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'        : 'alloc:recorder:trace',
            'CALI_ALLOC_RESOLVE_ADDRESSES': 'true',
            'CALI_RECORDER_FILENAME'      : 'stdout',
            'CALI_LOG_VERBOSITY'          : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 5)

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.0' : 'true',
                        'alloc.uid#ptr_in'       : '1',
                        'alloc.index#ptr_in'     : '0',
                        'alloc.label#ptr_in'     : 'test_alloc_A'
                    }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.1' : 'true',
                        'alloc.uid#ptr_in'       : '1',
                        'alloc.index#ptr_in'     : '41',
                        'alloc.label#ptr_in'     : 'test_alloc_A'
                    }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'alloc.uid#ptr_in' }))
예제 #22
0
    def helper_test_hook(self, hook):

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                              'test_alloc.allocated.0',
                              'alloc.uid#ptr_in',
                              'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.0' : 'true',
                             'alloc.index#ptr_in'     : '0'
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.0',
                             'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_in',
                             'ptr_in', 'ptr_out' }))

        index = '41' if hook == 'calloc' else '167'  # 41*sizeof(int)-1
        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.1' : 'true',
                             'alloc.index#ptr_in'     : index
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'alloc.uid#ptr_in' }))
예제 #23
0
    def test_papi(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'event:papi:trace:recorder',
            'CALI_PAPI_COUNTERS'     : 'PAPI_TOT_CYC',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'papi.PAPI_TOT_CYC', 'phase', 'iteration' }))
예제 #24
0
    def helper_test_hook(self, hook):

        # test allocated.0

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                              'test_alloc.allocated.0',
                              'alloc.uid#ptr_in',
                              'ptr_in', 'ptr_out' }))

        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.0' : 'true',
                             'alloc.index#ptr_in'     : '0'
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.0',
                             'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_in',
                             'ptr_in', 'ptr_out' }))

        index = '41' if hook == 'calloc' else '167'  # 41*sizeof(int)-1
        self.assertTrue(cat.has_snapshot_with_attributes(
            self.snapshots, {'test_alloc.' + hook + '_hook' : 'true',
                             'test_alloc.allocated.1' : 'true',
                             'alloc.index#ptr_in'     : index
                             }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.allocated.1',
                             'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'ptr_in', 'ptr_out' }))

        self.assertFalse(cat.has_snapshot_with_keys(
            self.snapshots, { 'test_alloc.' + hook + '_hook',
                             'test_alloc.freed',
                             'alloc.uid#ptr_in' }))
    def test_alloc(self):
        target_cmd = [ './ci_test_alloc' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'alloc:recorder:trace',
            'CALI_ALLOC_TRACK_RANGES': 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 4)

        # test allocated.0

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'ptr_in', 'ptr_out' }))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.0' : 'true',
                        'alloc.uid#ptr_in'       : '0',
                        'alloc.index#ptr_in'     : '0'
                    }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.0', 'alloc.uid#ptr_out' }))

        # test allocated.1

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'ptr_in', 'ptr_out' }))

        self.assertTrue(calitest.has_snapshot_with_attributes(
            snapshots, {'test_alloc.allocated.1' : 'true',
                        'alloc.uid#ptr_in'       : '0',
                        'alloc.index#ptr_in'     : '41'
                    }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.allocated.1', 'alloc.uid#ptr_out' }))

        # test allocated.freed

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'ptr_in', 'ptr_out' }))

        self.assertFalse(calitest.has_snapshot_with_keys(
            snapshots, { 'test_alloc.freed', 'alloc.uid#ptr_in' }))
예제 #26
0
    def test_f_ann_trace(self):
        target_cmd = ['./ci_test_f_ann', 'event-trace,output=stdout']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {'CALI_LOG_VERBOSITY': '0'}

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'annotation', 'time.inclusive.duration'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'main/work'}))
        self.assertTrue(
            cat.has_snapshot_with_attributes(snapshots,
                                             {'annotation': 'main/foo'}))
예제 #27
0
    def test_memusage(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'event,memusage,trace,recorder',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'malloc.total.bytes',
                         'phase',
                         'iteration' }))
예제 #28
0
    def test_libpfm_sampling(self):
        target_cmd = [ './ci_dgemm_memtrack' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'        : 'event:libpfm:pthread:trace:recorder',
            'CALI_LIBPFM_ENABLE_SAMPLING' : 'true',
            'CALI_LIBPFM_RECORD_COUNTERS' : 'false',
            'CALI_LIBPFM_EVENTS'          : 'instructions',
            'CALI_RECORDER_FILENAME'      : 'stdout',
            'CALI_LOG_VERBOSITY'          : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'libpfm.event_sample_name', 'libpfm.ip', 'libpfm.time' }))
예제 #29
0
    def test_ioservice_multichannel_disabled(self):
        # Enable the IO service in the default config but not in the trace channel.
        # While I/O regions will be on the shared blackboard, there should be no
        # I/O event records in the trace channel.

        target_cmd = [ './ci_test_io', 'event-trace(trace.io=false,output=stdout)' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_LOG_VERBOSITY'     : '0',
            'CALI_SERVICES_ENABLE'   : 'event,io,trace',
            'CALI_CHANNEL_CONFIG_CHECK' : 'false'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, { 'function': 'main' }))
        self.assertFalse(cat.has_snapshot_with_keys(
            snapshots, { 'io.region' }))
예제 #30
0
    def test_basic_trace(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_CONFIG_PROFILE'    : 'serial-trace',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 10)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, {'iteration', 'phase', 'time.inclusive.duration'}))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'event.end#phase': 'initialization', 'phase': 'initialization'}))
        self.assertTrue(cat.has_snapshot_with_attributes(
            snapshots, {'event.end#iteration': '3', 'iteration': '3', 'phase': 'loop'}))
예제 #31
0
    def test_libpfm_counting(self):
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'          : 'event:libpfm:trace:recorder',
            'CALI_LIBPFM_ENABLE_SAMPLING'   : 'false',
            'CALI_LIBPFM_RECORD_COUNTERS'   : 'true',
            'CALI_LIBPFM_EVENTS'            : 'cycles',
            'CALI_LIBPFM_SAMPLE_PERIOD'     : '10000000',
            'CALI_LIBPFM_SAMPLE_ATTRIBUTES' : 'ip,time',
            'CALI_RECORDER_FILENAME'        : 'stdout',
            'CALI_LOG_VERBOSITY'            : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'libpfm.counter.cycles', 'phase', 'iteration' }))
예제 #32
0
    def test_callpath(self):
        target_cmd = [ './ci_test_alloc' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'callpath:trace:recorder:alloc',
            'CALI_CALLPATH_USE_NAME' : 'true',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) == 5)

        self.assertTrue(cat.has_snapshot_with_keys(
            snapshots, { 'callpath.address', 'callpath.regname', 'test_alloc.allocated.0', 'function' }))

        sreg = cat.get_snapshot_with_keys(snapshots, { 'callpath.regname', 'test_alloc.allocated.0' })

        self.assertTrue('main/ci_test_alloc' in sreg.get('callpath.regname'))
예제 #33
0
    def test_measurement_template(self):
        target_cmd = ['./ci_test_basic']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE':
            'event,measurement_template,trace,recorder',
            'CALI_MEASUREMENT_TEMPLATE_NAMES': 'ci_test',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd,
                                                    caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(
            calitest.has_snapshot_with_keys(
                snapshots,
                {'phase', 'measurement.val.ci_test', 'measurement.ci_test'}))
예제 #34
0
    def test_mpi_msg_trace(self):
        target_cmd = ['./ci_test_mpi_before_cali']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'PATH': '/usr/bin',  # for ssh/rsh
            'CALI_LOG_VERBOSITY': '0',
            'CALI_SERVICES_ENABLE': 'event,mpi,recorder,trace',
            'CALI_MPI_MSG_TRACING': 'true',
            'CALI_MPI_WHITELIST': 'all',
            'CALI_RECORDER_FILENAME': 'stdout'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'function': 'main',
                    'mpi.function': 'MPI_Barrier',
                    'mpi.coll.type': '1',
                    'mpi.comm.is_world': 'true'
                }))
        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'function': 'main',
                    'mpi.function': 'MPI_Bcast',
                    'mpi.coll.type': '3',
                    'mpi.coll.root': '0',
                    'mpi.comm.is_world': 'true'
                }))
        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots,
                {'function', 'mpi.function', 'mpi.coll.type', 'mpi.call.id'}))
예제 #35
0
    def test_papi_aggr(self):
        # PAPI counters should be aggregated
        target_cmd = [ './ci_test_basic' ]
        query_cmd  = [ '../../src/tools/cali-query/cali-query', '-e' ]

        caliper_config = {
            'CALI_SERVICES_ENABLE'   : 'aggregate:event:papi:recorder',
            'CALI_AGGREGATE_KEY'     : 'phase',
            'CALI_PAPI_COUNTERS'     : 'PAPI_TOT_CYC',
            'CALI_RECORDER_FILENAME' : 'stdout',
            'CALI_LOG_VERBOSITY'     : '0'
        }

        query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
        snapshots = calitest.get_snapshots_from_text(query_output)

        self.assertTrue(len(snapshots) > 1)

        self.assertTrue(calitest.has_snapshot_with_keys(
            snapshots, { 'sum#papi.PAPI_TOT_CYC', 
                         'min#papi.PAPI_TOT_CYC', 
                         'max#papi.PAPI_TOT_CYC',
                         'phase' }))
예제 #36
0
    def test_alloc(self):
        target_cmd = ['./ci_test_alloc']
        query_cmd = ['../../src/tools/cali-query/cali-query', '-e']

        caliper_config = {
            'CALI_SERVICES_ENABLE': 'alloc:recorder:trace:event',
            'CALI_EVENT_ENABLE_SNAPSHOT_INFO': 'false',
            'CALI_ALLOC_RESOLVE_ADDRESSES': 'true',
            'CALI_RECORDER_FILENAME': 'stdout',
            'CALI_LOG_VERBOSITY': '0'
        }

        query_output = cat.run_test_with_query(target_cmd, query_cmd,
                                               caliper_config)
        snapshots = cat.get_snapshots_from_text(query_output)

        # test allocated.0

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.allocated.0', 'ptr_in', 'ptr_out'}))

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'test_alloc.allocated.0': 'true',
                    'alloc.uid#ptr_in': '1',
                    'alloc.index#ptr_in': '0',
                    'alloc.label#ptr_in': 'test_alloc_A'
                }))

        self.assertFalse(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.allocated.0', 'alloc.uid#ptr_out'}))

        # test allocated.1

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.allocated.1', 'ptr_in', 'ptr_out'}))

        self.assertTrue(
            cat.has_snapshot_with_attributes(
                snapshots, {
                    'test_alloc.allocated.1': 'true',
                    'alloc.uid#ptr_in': '1',
                    'alloc.index#ptr_in': '41',
                    'alloc.label#ptr_in': 'test_alloc_A'
                }))

        self.assertFalse(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.allocated.1', 'alloc.uid#ptr_out'}))

        # test allocated.freed

        self.assertTrue(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.freed', 'ptr_in', 'ptr_out'}))

        self.assertFalse(
            cat.has_snapshot_with_keys(
                snapshots, {'test_alloc.freed', 'alloc.uid#ptr_in'}))