Скачиваний:
12
Добавлен:
01.05.2014
Размер:
1.03 Mб
Скачать

Uml диаграмма классов

Исследование программы при помощи Profiler

В интегрированной среде VisualC++ пользователю предоставляется несколько предустановленных вариантов оптимизации программы:

    1. Default– оптимизация в этом случае не выполянется

    2. maximizespeed– максимизируется скорость выполнения программы.

Включена опция /O2 = /Og/Oy/Ob1 /Gs/Gf/Gy/Oi/Ot

    1. minimizesize– минимизируется размер программы.

Включена опция /O1 = /Og /Oy /Ob1 /Gs /Gf /Gy /Os

MS Visual C++ 6.0 "C" optimizations

Выделенные опции установлены по умолчанию

Name

Option

Description

Blend

/GB

Optimize for 386 and above

Pentium

/G5

Optimize for Pentium and above

Pentium Pro

/G6

Optimize for PentiumPro and above

Windows

/GA

Optimize for Windows (specifically access to thread-specific data)

DLL

/GD

Not currently implemented. Reserved for future use.

Cdecl

/Gd

Caller cleans stack. Slow. Allows variable argument functions. Alternate: __cdecl

Stdcall

/Gz

Callee cleans stack. Fast. No variable argument functions. Alternate: __stdcall

Fastcall

/Gr

Callee cleans stack. Uses registers. Fastest. No variable argument functions. Can't be used with _export. Alternate: __fastcall

String pooling

/Gf

Put duplicate strings in one memory location.

String pooling RO

/GF

Put duplicate strings in one read-only memory location.

Stack probes off

/Gs

Turn off stack checking. Alternate: #pragma check_stack

Func-level linking

/Gy

Linker only includes functions referenced in the OBJ rather than the entire contents

Small

/O1

Same as /Og /Oy /Ob1 /Gs /Gf /Gy /Os (global opts, omit frame ptr, allow inlines, stack probes off, func-level linking, favor code size over speed)

Fast

/O2

Same as /Og /Oy /Ob1 /Gs /Gf /Gy /Oi /Ot (global opts, omit frame ptr, allow inlines, stack probes off, func-level linking, favor code speed, intrinsic functions)

No aliasing

/Oa

Assume no aliasing occurs within functions. Alternate: #pragma optimize("a")

Intra-func aliasing

/Ow

Assume aliasing occurs across function calls. Alternate: #pragma optimize("w")

Disable all opts

/Od

Turn off all optimizations

Global opts

/Og

Turn on loop, common subexpression and register optimizations. Alternate: #pragma optimize("g")

Intrinsic functions

/Oi

Replace specific functions with inline versions (memcpy, strcpy, strlen, etc.). Alternate: #pragma intrinsic/function

Float consistency

/Op

Increase the precision of floating point operations at the expense of speed and size

Small code

/Os

Favor code size over speed. Alternate: #pragma optimize("s")

Fast code

/Ot

Favor code speed over size. Alternate: #pragma optimize("f")

Full optimizations

/Ox

Enable the following: /Ob1 /Og /Oi /Ot /Oy /Gs

Omit frame pointer

/Oy

Suppress creation of frame pointers on call stack. Frees the EBP register for other uses. Alternate: #pragma optimize("y")

Struct packing

/Zp8

Sets the structure member alignment. n=1,2,4,8(default),16. Smaller values generate smaller, slower code. Larger values generate larger, faster code.

MS Visual C++ 6.0 "C++" optimizations

Выделенные опции установлены по умолчанию

Name

Option

Description

No Vtable

__declspec

(novtable)

Stops the compiler from generating code to initialize the vfptr in the constructor. Apply to pure interface classes for code size reduction.

No Throw

__declspec

(nothrow)

Stops the compiler from tracking unwindable objects. Apply to functions that don't throw exceptions for code size reduction. Same as using C++ throw() specification.

Disable RTTI

/GR-

Turn off run time type information.

Exception handling

/GX

Turn on exception handling.

Inline expansion

/Ob1

Allow functions marked inline to be inline. Alternate: inline, __forceinline, #pragma inline_depth/inline_recursion

Inline any

/Ob2

Inline functions deemed appropriate by compiler. Alternate: #pragma auto_inline/inline_depth/inline_recursion

Ctor displacement

/vd0

Disable constructor displacement. Choose this option only if no class constructors or destructors call virtual functions. Use /vd1 (default) to enable. Alternate: #pragma vtordisp

Best case ptrs

/vmb

Use best case "pointer to class member" representation. Use this option if you always define a class before you declare a pointer to a member of the class. The compiler will issue an error if it encounters a pointer declaration before the class is defined. Alternate: #pragma pointers_to_members

Gen. purpose ptrs

/vmg

Use general purpose "pointer to class member" representation (the opposite of /vmb). Required if you need to declare a pointer to a member of a class before defining the class. Requires one of the following inheritance models: /vmm, /vms, /vmv. Alternate: #pragma pointers_to_members

Результаты профилирования программы с различными способами оптимизации

  1. default

Program Statistics

------------------

Command line at 2007 Oct 24 12:59: "C:\Program Files\Microsoft Visual Studio\MyProjects\lab1_3\Release\lab1_3"

Total time: 644,512 millisecond

Time outside of functions: 0,824 millisecond

Call depth: 20

Total functions: 638

Total hits: 167387

Function coverage: 70,2%

Overhead Calculated 8

Overhead Average 8

Module Statistics for lab1_3.exe

--------------------------------

Time in module: 643,688 millisecond

Percent of time in module: 100,0%

Functions in module: 638

Hits in module: 167387

Module function coverage: 70,2%

size: 167 936

  1. maximize speed

Program Statistics

------------------

Command line at 2007 Oct 24 12:51: "C:\Program Files\Microsoft Visual Studio\MyProjects\lab1_3\Release\lab1_3"

Total time: 434,632 millisecond

Time outside of functions: 0,394 millisecond

Call depth: 12

Total functions: 501

Total hits: 19716

Function coverage: 66,1%

Overhead Calculated 8

Overhead Average 8

Module Statistics for lab1_3.exe

--------------------------------

Time in module: 434,238 millisecond

Percent of time in module: 100,0%

Functions in module: 501

Hits in module: 19716

Module function coverage: 66,1%

size: 151 552

  1. minimize size

Program Statistics

------------------

Command line at 2007 Oct 24 12:56: "C:\Program Files\Microsoft Visual Studio\MyProjects\lab1_3\Release\lab1_3"

Total time: 491,842 millisecond

Time outside of functions: 1,248 millisecond

Call depth: 16

Total functions: 530

Total hits: 28110

Function coverage: 65,7%

Overhead Calculated 8

Overhead Average 8

Module Statistics for lab1_3.exe

--------------------------------

Time in module: 490,594 millisecond

Percent of time in module: 100,0%

Functions in module: 530

Hits in module: 28110

Module function coverage: 65,7%

size: 139 264

Не исполнявшиеся функции: конструкторы копирования.

Они используются классом Hash, который в этой программе не тестировался.