カテゴリー
AdobeユーザーコミュニティでおなじみのTenAとイラストレータあい(AI)のDTPとデザインおたすけサイト(^-^)/

performanceMetricで状態監視

先日menuActionとかいじっててサブメニュー山ほど追加して削除がめんどくさくなったので

app.menus.item(“$ID/Main”).submenus.everyItem().remove();

なんてことしちゃいました。ええ、笑うしかありません。気分的には草で画面全体をうめてしまいたいぐらいです。
きっとこの気持ちはやった人にしか分からないでしょうwww
それでもショートカットは使える所がよけいにおかしいですwww
二度としないと思うので記念にスクショも取りました。ついでですのでご覧下さい。

missing_menus.png

まあ、それは置いておいて、先日規模の大きいドキュメント向けに書いたscriptのパフォーマンスが出なくて困ってしまいました。ヒットカウントチェックしても正常ですし、これといって思い当たるコードも無いのでどうしようかと考え込んでしまいました。
少し調べてみるとJavascriptからIndesignの内部情報にアクセスする手だてがあるじゃないですか。

というわけで、見本です。

alert(‘CPU time : ‘ + app.performanceMetric(1668314484));

上記はIndesignのCPUタイムを表示します。

cuptime.png

そんなこんなプロパティが以下のようなもの

AGMXShowTime1095191924 = ‘AGMt’
Number of attachable events that have been dispatched.1095058292 = ‘AECt’
Number of attached scripts that have been executed.1095975796 = ‘ASCt’
BIB Allocations1112097345 = ‘BIBA’
BIB Allocations peak1111576683 = ‘BAPk’
BIB cache1112097379 = ‘BIBc’
BIB cache peak1111707755 = ‘BCPk’
change manager update call count1129137012 = ‘CMCt’
change manager update call time1129141357 = ‘CMTm’
The core allocation count.1128361059 = ‘CAlc’
The core memory size.1129539962 = ‘CSiz’
The CPU time.1668314484 = ‘cput’
The current memory mark.1296921195 = ‘MMrk’
database file bytes read1145197156 = ‘DBRd’
database file bytes written1145198450 = ‘DBWr’
database file page reads1145194098 = ‘DBFr’
database file read time1145197172 = ‘DBRt’
database file write time1145198452 = ‘DBWt’
database instantiate count1145194862 = ‘DBIn’
database new UID count1145197929 = ‘DBUi’
Total amount of time spent dispatching attachable events.1145394285 = ‘DETm’
draw manager draw time1145918573 = ‘DMTm’
draw manager number of interrupts1145915758 = ‘DMIn’
drop shadow file read bytes1145459298 = ‘DFRb’
drop shadow file read time1145459316 = ‘DFRt’
drop shadow file write bytes1145460578 = ‘DFWb’
drop shadow file write time1145460596 = ‘DFWt’
drop shadow memory read bytes1146311266 = ‘DSRb’
drop shadow memory read time1146311284 = ‘DSRt’
drop shadow memory write bytes1146312546 = ‘DSWb’
drop shadow memory write time1146312564 = ‘DSWt’
galley composition count1195590516 = ‘GCCt’
galley composition time1195594861 = ‘GCTm’
The GDI object count.1195657582 = ‘GDIn’
The handle count.1212378740 = ‘HCnt’
heap allocations1212247148 = ‘HAll’
heap allocations peak1212239979 = ‘HAPk’
image cache allocations1231897409 = ‘ImCA’
image cache allocations peak1229144427 = ‘ICAk’
image cache file bytes read1231901284 = ‘ImRd’
image cache file bytes written1231902578 = ‘ImWr’
image cache file read time1229148772 = ‘ICRd’
image cache file write time1229150066 = ‘ICWr’
instance cache purge count1229148259 = ‘ICPc’
layout composition count1279476596 = ‘LCCt’
layout composition time1279480941 = ‘LCTm’
memory purge count1297105780 = ‘MPCt’
memory purge time1297110125 = ‘MPTm’
minisave count1297302388 = ‘MSCt’
new snapshot time1397651284 = ‘SNwT’
The number of threads.1853122674 = ‘nthr’
The overall system CPU.1399025781 = ‘Scpu’
The overall user CPU.1432580213 = ‘Ucpu’
PDF allocactions1346651713 = ‘PDFA’
PDF allocactions peak1346650475 = ‘PDAk’
process IO bytes read1229935204 = ‘IORd’
process IO bytes written1229936498 = ‘IOWr’
The resident memory size.1381198202 = ‘RSiz’
snapshot count1397965684 = ‘SSCt’
snapshot read write byte count1397905251 = ‘SRWc’
snapshot read write time1397905268 = ‘SRWt’
The virtual memory size.1448307066 = ‘VSiz’
VXferAlloc1448633921 = ‘VXfA’
VXferAllocPeak1448624491 = ‘VXAk’
VXferBytesRead1448633938 = ‘VXfR’
VXferBytesWritten1448633943 = ‘VXfW’
VXferFileBytesRead1447445106 = ‘VFBr’
VXFerFileBytesWritten1447445111 = ‘VFBw’
VXferReadTime1448628852 = ‘VXRt’
VXferWriteTime1448630132 = ‘VXWt’
XMP filter time1481461876 = ‘XMPt’

やはり山のようにあります。ですから、ちまちま個別に見ていると手間がかかりますので…

var result = “”;

for (a in PerformanceMetricOptions) {
    result += a +”\t” + app.performanceMetric(PerformanceMetricOptions[a])+”\n”;
    }

$.write(result);
var w = new Window (“dialog”, ‘properties’);
var txbx = w.add (“edittext”, undefined, result, {multiline: true, scrolling: true});
txbx.maximumSize.height = w.maximumSize.height – 200;
txbx.minimumSize.width = 480;
w.add (“button”, undefined, “close”, {name: “ok”});
w.show ();

スクローラブルなUIに書き出すと同時にコンソールにも書き出してみました。

CPU_TIME    3612.385607
NUMBER_OF_THREADS    27
OVERALL_SYSTEM_CPU    1253.389078
OVERALL_USER_CPU    2359.101553
CORE_ALLOCATION_COUNT    0
CORE_MEMORY_SIZE    0
RESIDENT_MEMORY_SIZE    598945792
VIRTUAL_MEMORY_SIZE    2090872832
CURRENT_MEMORY_MARK    0
HANDLE_COUNT    0
GDI_OBJECT_COUNT    0
HEAP_ALLOCATIONS    0
HEAP_ALLOCATIONS_PEAK    0
MEMORY_PURGE_COUNT    2
MEMORY_PURGE_TIME    1049
BIB_ALLOCATIONS    -366073031
BIB_ALLOCATIONS_PEAK    -514498
BIB_CACHE    5752050
BIB_CACHE_PEAK    8848608
PDF_ALLOCACTIONS    856096
PDF_ALLOCACTIONS_PEAK    0
IMAGE_CACHE_ALLOCATIONS    0
IMAGE_CACHE_ALLOCATIONS_PEAK    65473720
IMAGE_CACHE_FILE_BYTES_READ    0
IMAGE_CACHE_FILE_BYTES_WRITTEN    0
IMAGE_CACHE_FILE_READ_TIME    0
IMAGE_CACHE_FILE_WRITE_TIME    0
VXFERALLOC    0
VXFERALLOCPEAK    65568768
VXFERBYTESREAD    550654832
VXFERBYTESWRITTEN    520595052
VXFERREADTIME    0
VXFERWRITETIME    0
VXFERFILEBYTESREAD    72286208
VXFERFILEBYTESWRITTEN    169967616
PROCESS_IO_BYTES_READ    0
PROCESS_IO_BYTES_WRITTEN    0
AGMXSHOWTIME    0
DATABASE_FILE_BYTES_READ    0
DATABASE_FILE_BYTES_WRITTEN    0
DATABASE_FILE_READ_TIME    0
DATABASE_FILE_WRITE_TIME    0
DROP_SHADOW_MEMORY_READ_TIME    0
DROP_SHADOW_MEMORY_READ_BYTES    0
DROP_SHADOW_MEMORY_WRITE_TIME    0
DROP_SHADOW_MEMORY_WRITE_BYTES    0
DROP_SHADOW_FILE_READ_TIME    0
DROP_SHADOW_FILE_READ_BYTES    0
DROP_SHADOW_FILE_WRITE_TIME    0
DROP_SHADOW_FILE_WRITE_BYTES    0
CHANGE_MANAGER_UPDATE_CALL_COUNT    73430
CHANGE_MANAGER_UPDATE_CALL_TIME    0
SNAPSHOT_COUNT    11212
GALLEY_COMPOSITION_TIME    0
LAYOUT_COMPOSITION_TIME    0
GALLEY_COMPOSITION_COUNT    0
LAYOUT_COMPOSITION_COUNT    93
DRAW_MANAGER_DRAW_TIME    0
DRAW_MANAGER_NUMBER_OF_INTERRUPTS    3
SNAPSHOT_READ_WRITE_TIME    0
NEW_SNAPSHOT_TIME    0
DATABASE_NEW_UID_COUNT    9274
DATABASE_INSTANTIATE_COUNT    16908290
INSTANCE_CACHE_PURGE_COUNT    14905
MINISAVE_COUNT    113
XMP_FILTER_TIME    0
SNAPSHOT_READ_WRITE_BYTE_COUNT    638352
DATABASE_FILE_PAGE_READS    0
ATTACHABLE_EVENT_COUNT    822
ATTACHED_SCRIPTS_COUNT    31
DISPATCH_EVENT_TIME    96242

結局、いろいろやってみてテーブルが大きすぎると言う事でした。あんまり役に立っていないような…

コメントを残す

Translate »