code: def test_xpu_profile(capfd, get_dataset, export_chrome_trace):
      dataset = get_dataset(name="Cora")
      device = torch.device("xpu")
      data = dataset[0].to(device)
      model = GraphSAGE(
          dataset.num_features,
          hidden_channels=64,
          num_layers=3,
          out_channels=dataset.num_classes,
      ).to(device)
  
      with xpu_profile(export_chrome_trace):
          model(data.x, data.edge_index)
  
      out, _ = capfd.readouterr()
      assert "Self CPU" in out
      if data.x.is_xpu:
          assert "Self XPU" in out
  
      f_name = "timeline.json"
      f_exists = osp.exists(f_name)
      if not export_chrome_trace:
          assert not f_exists
      else:
          assert f_exists
          os.remove(f_name)
  
file_path: pytorch_geometric/test/profile/test_profile.py
imports: import os
  import os.path
  import warnings
  import pytest
  import torch
  import torch.nn.functional
  from torch_geometric.nn import GraphSAGE
  from torch_geometric.profile import get_stats_summary, profileit, rename_profile_file, timeit
  from torch_geometric.profile.profile import torch_profile, xpu_profile
  from torch_geometric.testing import onlyCUDA, onlyLinux, onlyOnline, onlyXPU, withCUDA, withPackage
label_desc: Use image node_id 5 for calling a global function with example usage: test_xpu_profile(capfd, get_dataset, export_chrome_trace) without return types