diff --git a/README.md b/README.md index ee1c39f..626d876 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # app_analysis ![Build](https://github.com/marchdev-tk/app_analysis/workflows/build/badge.svg) @@ -5,17 +6,120 @@ ![GitHub](https://img.shields.io/github/license/marchdev-tk/app_analysis) ![GitHub stars](https://img.shields.io/github/stars/marchdev-tk/app_analysis?style=social) -Package that provides an ability to track device stats, including CPU/RAM/Battery/Traffic. +A Flutter package to analyze your app's performance, resource usage, and gather runtime information like CPU temperature, memory usage, network traffic, and more. ## Getting Started `ONLY ANDROID OS IS SUPPORTED!` -Add intro here -## Examples -Add examples here + +--- + +## Features + +- Start and stop app analysis easily. +- Monitor CPU information (temperature, frequency). +- Track memory usage. +- Collect and analyze HTTP traffic data. +- Retrieve comprehensive analysis data as JSON. + +--- + +## Installation + +Add this package to your `pubspec.yaml` file: + +```yaml +dependencies: + app_analysis: ^latest_version +``` + +Then run: + +```bash +flutter pub get +``` + +## Usage + +Import the package: + +```dart +import 'package:app_analysis/app_analysis.dart'; +``` + +### Initialize and Start Analysis + +```dart +final analyser = AppAnalyser(); +analyser.initialise(); + +analyser.start(); +``` + +### Stop Analysis and Get Results + +```dart +final info = await analyser.stop(); + +print(info.toMap()); +``` + +### Collecting HTTP Traffic Information + +```dart +final request = await HttpClient().getUrl(Uri.parse('https://your-api.com')); +final response = await request.close(); + +AppAnalyser().collectTraffic( + HttpClientTrafficConsumptionAdapter( + HttpClientRequestResponse(request.toExtended(), response.toExtended()), + ), +); +``` + +### Getting CPU Information + +```dart +final cpuInfo = CpuInfoProvider(); + +print('Temperature: ${await cpuInfo.temperature}'); +print('Average Temp: ${await cpuInfo.averageTemperature}'); +print('Current Freq: ${await cpuInfo.currentFrequency}'); +print('Extremum Freq: ${await cpuInfo.extremumFrequency}'); +``` + +### Example Output of Analysis Data + +```json +{ + "cpu": { + "temperature": 45.5, + "averageTemperature": 43.2, + "currentFrequency": "2.4GHz", + "extremumFrequency": "1.2GHz - 2.8GHz" + }, + "memory": { + "total": "4096MB", + "used": "1536MB", + "free": "2560MB" + }, + "network": { + "trafficConsumption": [ + { + "requestSize": "2KB", + "responseSize": "5KB" + } + ] + } +} +``` + +## Example App + +Check out the example directory for a complete implementation. ## Feature requests and Bug reports @@ -23,7 +127,7 @@ Feel free to post a feature requests or report a bug [here](https://github.com/m ## TODO -* Add docs -* Migrate to platform agnostic file operations -* Remove external `battery_info` dependency in favour of custom data provider -* Add interesting data based on analysis results in `AnalysisInfo` model +- Add docs +- Migrate to platform agnostic file operations +- Remove external `battery_info` dependency in favour of custom data provider +- Add interesting data based on analysis results in `AnalysisInfo` model \ No newline at end of file