קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
המעקב של Winscope הוא חלק מהמסגרת של Android. בדף הזה מפורטים השלבים הנדרשים כדי להוריד, ליצור ולהריץ את כלי הצפייה בנתוני המעקב של Winscope באופן מקומי.
כדי לראות את רשימת הפקודות הזמינות, מריצים את הפקודה: npm run
יצירת גרסאות build לכל יעדי הייצור והבדיקה באמצעות:
npm run build:prod
מפעילים את Winscope באמצעות:
npm run start
פיתוח חלקים נפרדים
אפשר ליצור חלקים נפרדים של Winscope בנפרד באמצעות הפקודות הבאות:
פקודה
תיאור
build:trace_processor
בודקים את הגרסה האחרונה של trace_processor של Perfetto ובונים אותה מחדש.
build:protos
קומפילציה מחדש של הגדרות ה-proto.
הרצת בדיקות
Winscope מכיל בדיקות יחידה ובדיקות מקצה לקצה. כדי להריץ אותן, משתמשים ב-npm run
<command>:
פקודה
תיאור
test:unit:ci
הרצת בדיקות היחידה בפורמט פחות מפורט ל-CI
או ל-hook של שליחת קובץ לבדיקה.
test:unit:dev
הפעלת בדיקות היחידה בפורמט מפורט יותר לפיתוח מקומי . במצב הזה המערכת עוקבת אחרי שינויים ומריצה אוטומטית את הבדיקות הנכונות.
test:e2e
הרצת הבדיקות מקצה לקצה, כמו הבדיקות של הפרוטוקול לכל הכלים.
test:presubmit:quiet
הכלי יוצר את כל בדיקות היחידות, ה-linters והניתוחים של התרשימים
לפני שליחת הקוד לבדיקה, בפורמט פחות מפורט ל-CI או ל-hook
לפני שליחת הקוד לבדיקה.
test:presubmit
ה-build כולל את כל בדיקות היחידות, ה-linters והניתוחים של התרשימים
שנעשים לפני שליחת הקוד, בפורמט מפורט יותר לפיתוח
מקומי.
test:all
הפעלת כל הבדיקות (בדיקות יחידה ובדיקות מקצה לקצה), כלים לאיתור שגיאות בקוד וניתוח גרפים בפורמט מפורט יותר לפיתוח מקומי.
עדכון המיפוי של @IntDef
@IntDef הוא הערה שמשמשת ב-Android כדי להגביל את הערכים האפשריים של מספר שלם. Winscope משתמש במיפוי של ההערות האלה כדי להציג את שם הערך במקום את המספר השלם.
כדי לעדכן את המיפוי של @IntDef:
כדי להריץ את מעבד הקדם של ההערות, צריך לבנות את :framework-minus-apex-intdefs:
mp:framework-minus-apex-intdefs
מעתיקים את קובץ ה-intDefMapping.json שנוצר למאגר של ה-prebuilts:
בנוסף ל-build ולבדיקות, סקריפטים של Winscope מכילים יכולות נוספות, כפי שמפורט בטבלה. כדי להריץ אותן, משתמשים ב-npm run command:
פקודה
תיאור
format:check
בדיקה של בעיות בעיצוב הקוד באמצעות prettier.
format:fix
בדיקה ותיקון אוטומטי של בעיות בעיצוב הקוד באמצעות prettier.
eslint:check
בדיקה של בעיות בעיצוב הקוד באמצעות eslint.
eslint:fix
בדיקה ותיקון אוטומטי של בעיות בעיצוב הקוד באמצעות eslint.
tslint:check
בדיקה של בעיות בעיצוב הקוד באמצעות tslint.
tslint:fix
בדיקה ותיקון אוטומטי של בעיות בעיצוב הקוד באמצעות tslint.
deps_graph:check_cycles
ניתוח הקוד לזיהוי יחסי תלות מעגליים.
פתרון בעיות
כדי לפתור את הבעיה, תוכלו להיעזר בטיפים הבאים:
שגיאה ProtocolError: missing required '<FIELD>' או TypeError: Cannot
read property '<PROP>' of null
המצב הזה מתרחש כאשר קובץ המעקב נוצר עם הגדרת proto חדשה, שמכילה שדות חובה חדשים.
חשוב לוודא שפותחים את המעקב בגרסה הנכונה של Winscope (master, S או R).
אם יוצרים את השדה החדש ב-proto, צריך לבצע קומפילציה מחדש של ה-protos ב-Winscope באמצעות npm run build:protos.
גרסאות מסוימות של יחסי התלות המותקנים שגויות (ה-build נכשל)
מבטלים את השינויים ב-package.json וב-package-lock.json. מסירים את node_modules. מריצים שוב את npm install.
הוספת שדה חדש לאחד מקובצי ה-proto. איך מציגים אותו?
Winscope משתמש בהגדרות ה-proto מהזמן שבו הוא עבר הידור, כך ששדות חדשים לא יופיעו כברירת מחדל. כדי להציג שדות חדשים, צריך ליצור מחדש את ה-protos באמצעות npm run build:protos.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-24 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-24 (שעון UTC)."],[],[],null,["# Run Winscope\n\nWinscope tracing is part of the Android framework. This page outlines the\nsteps required to download, build, and run the Winscope trace viewer locally.\n\nBuild Winscope locally\n----------------------\n\nFollow these steps to set up your PC to run the Winscope tracer:\n\n1. [Download the Android source](/docs/setup/build/building).\n2. Navigate to the Winscope folder:\n\n cd development/tools/winscope\n\n3. Install dependencies using:\n\n npm install\n\n To see a list of available commands, run: `npm run`\n4. Build all prod and test targets using:\n\n npm run build:prod\n\n5. Run Winscope using:\n\n npm run start\n\n| **Note:** You can also download and build Winscope to host on a standard web server to get a shareable link to the tool.\n\nBuild separate parts\n--------------------\n\nYou can build individual parts of Winscope separately using the following\ncommands:\n\n| Command | Description |\n|-------------------------|-----------------------------------------------------------------------------|\n| `build:trace_processor` | Checks out and rebuilds the latest version of Perfetto's `trace_processor`. |\n| `build:protos` | Recompiles the proto definitions. |\n\nRun tests\n---------\n\n| **Tip:** Winscope doesn't build on Soong and can't be built by Tradefed, so it's recommended to have a local Git hook to the tests in your local environment.\n\nWinscope contains unit and end-to-end tests. To run them use `npm run\n\u003ccommand\u003e`:\n\n| Command | Description |\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `test:unit:ci` | Runs the unit tests in a less verbose format for CI or presubmit hook. |\n| `test:unit:dev` | Runs the unit tests in a more verbose format for local development. This mode watches for changes and automatically reruns the correct tests. |\n| `test:e2e` | Runs the end-to-end tests, such as those for the cross-tool protocol. |\n| `test:presubmit:quiet` | Builds all presubmit unit tests, linters, and graph analysis in a less verbose format for CI or presubmit hook. |\n| `test:presubmit` | Builds all presubmit unit tests, linters, and graph analysis in a more verbose format for local development. |\n| `test:all` | Runs all tests (unit and end-to-end), linters, and graph analysis in a more verbose format for local development. |\n\n### Update @IntDef mapping\n\n`@IntDef` is an annotation used in Android to restrict the possible values of an\ninteger. Winscope uses a mapping of these annotations to display the name of the\nvalue instead of the integer.\n\nTo update the `@IntDef` mapping, do the following:\n\n1. Build `:framework-minus-apex-intdefs` for the annotation preprocessor to run:\n\n mp :framework-minus-apex-intdefs\n\n2. Copy the generated `intDefMapping.json` file to the prebuilts repository:\n\n $ python3 -c 'import sys,json,collections; print(json.dumps(collections.OrderedDict(sorted(collections.ChainMap(*map(lambda x:json.load(open(x)), sys.argv[1:])).items())), indent=2))' $(find out/soong/.intermediates/frameworks/base -iname intDefMapping.json) \u003e ./development/tools/winscope/src/common/intDefMapping.json\n\n3. Upload the changes in Winscope using `repo upload`.\n\nOther commands\n--------------\n\nIn addition to build and tests, Winscope scripts contain other capabilities, as\nshown in the table. To run them use `npm run `\u003cvar translate=\"no\"\u003ecommand\u003c/var\u003e:\n\n| Command | Description |\n|---------------------------|----------------------------------------------------------------|\n| `format:check` | Checks for code formatting issues using `prettier`. |\n| `format:fix` | Checks and auto fixes code formatting issues using `prettier`. |\n| `eslint:check` | Checks for code formatting issues using `eslint`. |\n| `eslint:fix` | Checks and auto fixes code formatting issues using `eslint`. |\n| `tslint:check` | Checks for code formatting issues using `tslint`. |\n| `tslint:fix` | Checks and auto fixes code formatting issues using `tslint`. |\n| `deps_graph:check_cycles` | Analyzes the code for cyclical dependencies. |\n\nTroubleshoot\n------------\n\nUse the following tips for troubleshooting:\n\n- **Error `ProtocolError: missing required '\u003cFIELD\u003e'` or `TypeError: Cannot\n read property '\u003cPROP\u003e' of null`**\n\n - This occurs when the trace file was created with a new proto definition,\n containing new *required* fields.\n\n 1. Make sure you're opening the trace on the correct Winscope version (master, S, or R).\n 2. If you create the new field on the proto, recompile the protos in\n Winscope using `npm run build:protos`.\n\n | **Note:** You shouldn't need a new required field, because the protos should be backward compatible.\n- **Some installed dependency versions are wrong (build fails)**\n\n - Revert changes to `package.json` and `package-lock.json`. Remove `node_modules`. Run `npm install` again.\n- **I added a new field to one of the proto files. How do I display it?**\n\n - Winscope uses the proto definitions from when it was compiled, so new fields won't appear by default. To show new fields, rebuild the protos using `npm run build:protos`."]]