indexing description: "benchmark asynchronous logging of CBE's" library: "elogger" copyright: "Copyright (c) 2006, AXA Rosenberg, and others (see copyright.txt)" author: "Ulrich Weiss, and others" license: "Eiffel Forum License v2 (see forum.txt)" date: "$Date: $" revision: "$Revision: $" archive: "$Archive: $" class ELOG_BENCHMARK_LOGGING_CBE_ASYNC inherit ELOG_BENCHMARK_CASE ELOG_SEVERITY_CONSTANTS feature -- Access run is -- run the benchmark local h: ELOG_HIERARCHY ap: ELOG_TRASH_APPENDER i: INTEGER cbe: ELOG_COMMON_BASE_EVENT e,e2,e3: ELOG_CBE_EXTENDED_DATA_ELEMENT ae: ELOG_CBE_ASSOCIATED_EVENT a: ARRAY [INTEGER_8] source_component: ELOG_CBE_COMPONENT cf: ELOG_CBE_COMPONENT_FACTORY mde: ELOG_CBE_MSG_DATA_ELEMENT do create h.make (Warning_severity) create ap.make ("trashappender", False) ap.set_layout (create {ELOG_CBE_XML_LAYOUT}.make) h.root.add_appender (ap) ap.write_header -- start timer start from i := 0 until i > iterations loop create cbe.make ("some event message") create ae.make_with_association_engine ("i0000000000000000000000000000043") ae.set_resolved_events ("i0000000000000000000000000000040") cbe.add_associated_event (ae) create ae.make_with_association_engine_info (create {ELOG_CBE_ASSOCIATION_ENGINE}.make ("myengine", "Correlate", "i0000000000000000000000000000044")) cbe.add_associated_event (ae) create ae.make_with_association_engine_info (create {ELOG_CBE_ASSOCIATION_ENGINE}.make ("myengine", "Correlate", "i0000000000000000000000000000045")) cbe.add_associated_event (ae) cbe.add_context_data_element (create {ELOG_CBE_CONTEXT_DATA_ELEMENT}.make_with_value ("STring", "mycontext", "myvalue")) cbe.add_context_data_element (create {ELOG_CBE_CONTEXT_DATA_ELEMENT}.make_with_id ("STring", "mycontext", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaID")) a := create {ARRAY [INTEGER_8]}.make (1, 3) a.put (23, 1) a.put (24, 2) a.put (25, 3) create e.make ("mainede", a) create e2.make ("child1a", a) e.add_child (e2) create e3.make ("child2", a) e2.add_child (e3) create e3.make ("child1b", a) e.add_child (e3) cbe.add_extended_data_element (e) cbe.set_elapsed_time (100) cbe.set_extension_name ("my extension name") cbe.set_global_instance_id cbe.set_local_instance_id ("mylocal instance id") create mde.make mde.add_msg_catalog_token ("a token") mde.add_msg_catalog_token ("another token") mde.set_msg_catalog ("a msg catalog") mde.set_msg_catalog_id ("a msg catalog id") mde.set_msg_catalog_type ("a msg catalog type") mde.set_msg_id ("a msg id") mde.set_msg_id_type ("a msg catalog type") cbe.set_msg_data_element (mde) cbe.set_priority (34) cbe.set_repeat_count (54) create cf source_component := cf.new_component_with_context ("my source component") source_component.set_application ("test app") source_component.set_component_id_type ("cmp id type") source_component.set_component_type ("cmp type") source_component.set_execution_environment ("exec env") source_component.set_instance_id ("inst id") source_component.set_location ("loc") source_component.set_location_type ("loctype") source_component.set_sub_component ("subcompnt") cbe.set_source_component (source_component) cbe.set_reporter_component (create {ELOG_CBE_COMPONENT}.make ("my reporter component")) cbe.set_sequence_number (23) cbe.set_situation (create {ELOG_CBE_SITUATION}.make ("my category name", create {ELOG_CBE_START_SITUATION}.make ("SUCCESSFUL", "aoeu"))) h.root.log_fatal (cbe) i := i + 1 end -- stop -- here to have the peak speed without ap.wait (False) ap.write_footer stop h.close_all io.putstring ("async cbe logging: "+iterations_per_second.rounded.out+"it/s, "+cycles_per_iteration.out+"cycles/it%N") end iterations: INTEGER_64 is 1000 -- nr of iterations end