GUADEC dtrace, normalized time spent in Cairo

Those attending the GUADEC performance bof may be interested in this little dtrace script based on normtime.d:
#!/usr/sbin/dtrace -s
#pragma D option quiet

BEGIN
{
        /\*
         \* Get the start time, in nanoseconds.
         \*/
        start = timestamp;
}

pid$target::\*cairo\*:entry
{
        @func[probefunc] = count();
}

END
{
        /\*
         \* Normalize the aggregation based on the number of seconds we have
         \* been running.  (There are 1,000,000,000 nanoseconds in one second.)
         \*/
        normalize(@func, (timestamp - start) / 1000000000);
}


run it with cairo.d -c gedit and play with gedit:
  _cairo_ft_unscaled_font_keys_equal                                0
  cairo_font_iface_init                                             0
  cairo_font_map_iface_init                                         0
  cairo_font_options_set_hint_metrics                               0
  gdk_cairo_rectangle                                               0
  pango_cairo_fc_font_class_intern_init                             0
  pango_cairo_fc_font_map_class_intern_init                         0
  pango_cairo_fc_font_map_init                                      0
  pango_cairo_font_map_new                                          0
  pango_cairo_renderer_class_intern_init                            0
  pango_cairo_renderer_get_type                                     0
  pango_cairo_renderer_init                                         0
  _cairo_cache_init                                                 0
  _cairo_font_face_init                                             0
  _cairo_ft_unscaled_font_init                                      0
  _cairo_hash_table_create                                          0
  _cairo_unscaled_font_init                                         0
  cairo_font_options_set_antialias                                  0
  cairo_font_options_set_hint_style                                 0
  cairo_font_options_set_subpixel_order                             0
  cairo_line_to                                                     0
  _cairo_ft_font_face_create                                        0
  _cairo_ft_font_face_scaled_font_create                            0
  _cairo_ft_scaled_font_create                                      0
  _cairo_ft_scaled_font_font_extents                                0
  _cairo_ft_unscaled_font_create_for_pattern                        0
  _cairo_scaled_font_font_extents                                   0
  _cairo_scaled_font_init                                           0
  _cairo_unscaled_font_destroy                                      0
  cairo_ft_font_face_create_for_pattern                             0
  cairo_scaled_font_extents                                         0
  _cairo_matrix_get_affine                                          0
  cairo_ft_font_options_substitute                                  0
  pango_cairo_fc_font_map_context_substitute                        0
  _cairo_ft_unscaled_font_init_key                                  0
  _cairo_ft_unscaled_font_map_lock                                  0
  _cairo_ft_unscaled_font_map_unlock                                0
  _cairo_hash_string                                                0
  _cairo_hash_table_insert                                          0
  _cairo_hash_table_resize                                          0
  _cairo_matrix_compute_determinant                                 0
  _cairo_matrix_compute_scale_factors                               0
  _cairo_surface_composite_trapezoids                               1
  _cairo_traps_extents                                              1
  _cairo_xlib_surface_composite_trapezoids                          1
  _cairo_array_append                                               2
  _cairo_array_grow_by                                              2
  _cairo_clip_intersect_to_region                                   2
  _cairo_surface_fill_region                                        2
  _cairo_user_data_array_set_data                                   2
  cairo_surface_set_device_offset                                   2
  cairo_surface_set_user_data                                       2
  cairo_xlib_surface_create                                         2
  gdk_pixmap_ref_cairo_surface                                      2
  gdk_x11_cairo_surface_destroy                                     2
  gdk_x11_ref_cairo_surface                                         2
  pango_cairo_font_map_create_context                               2
  pango_cairo_font_map_get_default                                  2
  pango_cairo_context_set_resolution                                2
  cairo_font_options_create                                         2
  pango_cairo_context_set_font_options                              2
  _pango_cairo_fc_font_new                                          3
  pango_cairo_fc_font_get_type                                      3
  pango_cairo_fc_font_init                                          3
  pango_cairo_fc_font_map_create_font                               3
  pango_cairo_fc_font_map_get_type                                  3
  cairo_matrix_scale                                                3
  pango_cairo_fc_font_map_context_key_copy                          3
  _cairo_gstate_clip_and_composite_trapezoids                       3
  _cairo_gstate_fill                                                3
  _cairo_surface_clip_and_composite_trapezoids                      3
  _cairo_surface_fill_path                                          3
  cairo_fill                                                        3
  cairo_fill_preserve                                               3
  _cairo_image_surface_assume_ownership_of_data                     3
  _cairo_ft_scaled_font_glyph_extents                               3
  _cairo_ft_unscaled_font_create_glyph                              3
  _cairo_image_surface_create_for_pixman_image                      3
  _cairo_pixman_format_create                                       3
  _cairo_pixman_format_create_masks                                 3
  _cairo_pixman_format_destroy                                      3
  _cairo_pixman_format_init                                         3
  _cairo_pixman_image_create_for_data                               3
  _cairo_pixman_image_get_data                                      3
  _cairo_pixman_image_get_depth                                     3
  _cairo_pixman_image_get_height                                    3
  _cairo_pixman_image_get_stride                                    3
  _cairo_pixman_image_get_width                                     3
  _cairo_scaled_font_glyph_extents                                  3
  cairo_image_surface_create_for_data                               3
  cairo_scaled_font_glyph_extents                                   3
  _cairo_clip_reset                                                 4
  _cairo_gstate_reset_clip                                          4
  _cairo_gstate_translate                                           4
  cairo_identity_matrix                                             4
  cairo_reset_clip                                                  4
  cairo_translate                                                   4
  gdk_cairo_create                                                  4
  gdk_window_ref_cairo_surface                                      4
  cairo_font_options_destroy                                        5
  _cairo_unscaled_font_reference                                    6
  _cairo_gstate_show_glyphs_draw_func                               6
  _cairo_scaled_font_get_glyph_cache_key                            6
  _cairo_scaled_font_show_glyphs                                    6
  _cairo_surface_show_glyphs                                        6
  _cairo_xlib_surface_show_glyphs                                   6
  _cairo_xlib_surface_show_glyphs8                                  6
  _cairo_ft_scaled_font_glyph_bbox                                  6
  _cairo_gstate_backend_to_user                                     6
  _cairo_gstate_ensure_font_face                                    6
  _cairo_gstate_ensure_scaled_font                                  6
  _cairo_gstate_set_font_face                                       6
  _cairo_gstate_set_font_matrix                                     6
  _cairo_gstate_set_font_options                                    6
  _cairo_gstate_show_glyphs                                         6
  _cairo_path_fixed_get_current_point                               6
  _cairo_scaled_font_glyph_bbox                                     6
  _cairo_xlib_surface_get_font_options                              6
  _pango_cairo_font_install                                         6
  _pango_cairo_font_map_get_renderer                                6
  cairo_get_current_point                                           6
  cairo_scaled_font_destroy                                         6
  cairo_scaled_font_reference                                       6
  cairo_set_font_face                                               6
  cairo_set_font_matrix                                             6
  cairo_set_font_options                                            6
  cairo_show_glyphs                                                 6
  cairo_surface_get_font_options                                    6
  pango_cairo_fc_font_install                                       6
  pango_cairo_fc_font_map_get_renderer                              6
  pango_cairo_renderer_draw_glyphs                                  6
  pango_cairo_show_glyph_string                                     6
  _cairo_scaled_font_keys_equal                                     6
  cairo_scaled_font_create                                          6
  pango_cairo_fc_font_get_font_face                                 6
  cairo_font_face_reference                                         6
  _cairo_hash_table_lookup                                          6
  _cairo_scaled_font_init_key                                       6
  _cairo_hash_table_lookup_internal                                 6
  gdk_cairo_region                                                  6
  _cairo_clip_clip                                                  6
  _cairo_clip_init                                                  6
  _cairo_color_compute_shorts                                       6
  _cairo_color_init_rgb                                             6
  _cairo_color_init_rgba                                            6
  _cairo_gstate_clip                                                6
  _cairo_gstate_create                                              6
  _cairo_gstate_set_source                                          6
  _cairo_path_fixed_init                                            6
  _cairo_surface_allocate_clip_serial                               6
  _cairo_surface_get_clip_mode                                      6
  _cairo_surface_set_clip_region                                    6
  _cairo_xlib_surface_set_clip_region                               6
  cairo_clip                                                        6
  cairo_clip_preserve                                               6
  cairo_create                                                      6
  cairo_destroy                                                     6
  cairo_pattern_create_rgb                                          6
  cairo_set_source                                                  6
  cairo_set_source_rgb                                              6
  gdk_cairo_set_source_color                                        6
  pango_cairo_fc_font_get_metrics                                   7
  _cairo_matrix_is_integer_translation                              7
  _cairo_pattern_acquire_surface                                    7
  _cairo_pattern_acquire_surface_for_solid                          7
  _cairo_pattern_release_surface                                    7
  _cairo_surface_create_similar_scratch                             7
  _cairo_surface_create_similar_solid                               7
  _cairo_surface_fill_rectangle                                     7
  _cairo_xlib_surface_create_similar                                7
  _cairo_xlib_surface_set_attributes                                7
  _cairo_xlib_surface_set_repeat                                    7
  cairo_xlib_surface_create_with_xrender_format                     7
  get_cairo_context                                                 7
  _cairo_box_round_to_rectangle                                     8
  _cairo_clip_intersect_to_rectangle                                8
  _cairo_gstate_clip_and_composite                                  8
  _cairo_region_create_from_rectangle                               8
  _cairo_pixman_region_num_rects                                    9
  _cairo_pixman_region_rects                                        9
  _gdk_drawable_ref_cairo_surface                                   9
  cairo_font_options_merge                                          9
  cairo_font_options_copy                                           9
  _cairo_font_options_init_default                                  9
  _cairo_array_fini                                                 9
  _cairo_surface_fill_rectangles                                    9
  _cairo_user_data_array_fini                                       9
  _cairo_xlib_screen_info_get                                       9
  _cairo_xlib_surface_create_internal                               9
  _cairo_xlib_surface_fill_rectangles                               9
  _cairo_xlib_surface_finish                                        9
  cairo_surface_finish                                              9
  _cairo_gstate_copy_transformed_pattern                           10
  _cairo_gstate_copy_transformed_source                            10
  _cairo_pattern_init_copy                                         10
  _cairo_pattern_transform                                         10
  _cairo_pixman_region_extents                                     10
  _cairo_pixman_region_intersect                                   10
  _cairo_region_extents_rectangle                                  10
  _cairo_surface_get_current_clip_serial                           10
  _cairo_surface_set_clip                                          10
  cairo_matrix_translate                                           10
  cairo_matrix_init_scale                                          10
  _cairo_path_fixed_fill_to_traps                                  10
  _cairo_path_fixed_interpret                                      10
  _cairo_polygon_fini                                              10
  _cairo_polygon_init                                              10
  _cairo_traps_extract_region                                      10
  _cairo_traps_fini                                                10
  _cairo_traps_grow_by                                             10
  _cairo_traps_init                                                10
  _cairo_traps_tessellate_polygon                                  10
  _cairo_gstate_apply_device_inverse_transform                     11
  _cairo_gstate_apply_device_transform                             11
  _cairo_gstate_identity_matrix                                    11
  cairo_rectangle                                                  11
  pango_cairo_context_get_resolution                               11
  pango_cairo_fc_font_map_get_resolution_fc                        11
  _cairo_filler_close_path                                         11
  _cairo_path_fixed_close_path                                     11
  cairo_close_path                                                 11
  _cairo_traps_add_trap                                            11
  _cairo_get_global_image_glyph_cache                              12
  _cairo_lock_global_image_glyph_cache                             12
  _cairo_unlock_global_image_glyph_cache                           12
  _compare_cairo_edge_by_current_x_slope                           12
  pango_cairo_fc_font_map_context_key_equal                        12
  cairo_font_face_destroy                                          12
  _compare_cairo_edge_by_top                                       13
  _cairo_surface_init                                              13
  _cairo_array_init                                                13
  _cairo_path_arg_buf_create                                       13
  _cairo_path_fixed_add_arg_buf                                    13
  _cairo_path_fixed_add_op_buf                                     13
  _cairo_path_op_buf_create                                        13
  _cairo_pattern_create_solid                                      13
  _cairo_user_data_array_init                                      13
  _cairo_stock_color                                               14
  _cairo_xlib_surface_set_picture_clip_rects                       14
  _cairo_filler_move_to                                            14
  pango_cairo_font_map_get_type                                    15
  cairo_new_path                                                   15
  _cairo_format_from_content                                       15
  _cairo_fixed_integer_ceil                                        16
  _cairo_ft_scaled_font_get_glyph_cache_key                        16
  _cairo_clip_init_copy                                            17
  _cairo_gstate_clone                                              17
  _cairo_pen_init_copy                                             17
  cairo_restore                                                    17
  cairo_save                                                       17
  _cairo_xlib_surface_ensure_dst_picture                           17
  _cairo_operator_bounded                                          17
  _cairo_path_fixed_move_to                                        18
  cairo_move_to                                                    18
  _cairo_cache_shrink_to                                           18
  cairo_font_options_equal                                         19
  _cairo_fixed_integer_floor                                       19
  pango_cairo_fc_font_map_context_key_get                          19
  pango_cairo_font_get_type                                        19
  _cairo_scaled_font_map_lock                                      19
  _cairo_scaled_font_map_unlock                                    19
  cairo_matrix_init_translate                                      19
  pango_cairo_fc_font_map_context_key_hash                         20
  _cairo_restrict_value                                            20
  _cairo_pattern_init                                              21
  _cairo_pattern_init_solid                                        21
  _cairo_path_fixed_fini                                           22
  _pango_cairo_context_get_merged_font_options                     22
  _cairo_clip_fini                                                 24
  _cairo_gstate_destroy                                            24
  _cairo_pen_fini                                                  24
  cairo_pattern_reference                                          24
  _cairo_pixman_region_union                                       25
  _cairo_pattern_fini                                              25
  _cairo_pixman_region_union_rect                                  25
  cairo_ft_scaled_font_lock_face                                   26
  cairo_ft_scaled_font_unlock_face                                 26
  pango_cairo_fc_font_lock_face                                    26
  pango_cairo_fc_font_unlock_face                                  26
  cairo_font_options_hash                                          27
  _cairo_pixman_region_destroy                                     29
  _cairo_ft_unscaled_font_lock_face                                30
  _cairo_ft_unscaled_font_set_scale                                30
  _cairo_ft_unscaled_font_unlock_face                              30
  _cairo_pen_init_empty                                            31
  cairo_matrix_multiply                                            33
  _cairo_gstate_user_to_device_distance                            35
  _cairo_path_fixed_rel_line_to                                    35
  cairo_rel_line_to                                                35
  _cairo_filler_line_to                                            35
  _cairo_path_fixed_line_to                                        35
  _cairo_polygon_line_to                                           35
  _cairo_gstate_unset_scaled_font                                  35
  _cairo_polygon_close                                             37
  _cairo_pixman_region_create                                      37
  _cairo_pixman_region_create_simple                               37
  _cairo_pixman_region_copy                                        38
  cairo_pattern_destroy                                            38
  cairo_surface_destroy                                            39
  _cairo_fixed_integer_part                                        40
  pango_cairo_fc_font_get_glyph                                    41
  cairo_surface_reference                                          47
  _cairo_polygon_add_edge                                          50
  _cairo_gstate_user_to_backend                                    52
  _cairo_fixed_is_integer                                          57
  cairo_matrix_init_identity                                       59
  _cairo_polygon_move_to                                           64
  _cairo_path_fixed_add                                            65
  _cairo_cache_lookup                                              74
  _cairo_glyph_cache_keys_equal                                    75
  cairo_matrix_transform_point                                     82
  cairo_matrix_init                                                89
  _cairo_glyph_cache_hash                                          92
  _cairo_fixed_to_double                                          108
  cairo_matrix_transform_distance                                 117
  pango_cairo_fc_font_get_glyph_extents                           201
  pango_cairo_fc_font_get_scaled_font                             254
  _cairo_fixed_from_double                                        315


When I have more time I'll try this on the benchmark and also try it in a thin client environment where I expect things will be different. But now it is time for lunch!
Comments:

Post a Comment:
Comments are closed for this entry.
About

bnitz

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today